Performance tips of the day:
1. If you have an exit condition, detected it before opening a file, reading it from disk, processing it, copying to an appropriately sized memory block and then throwing it all away due to the exit condition.
2. Linear searches are bad. Linear searches are almost always the sign you've done something wrong. If you're annoyed that it takes you so much effort to convert your array/vector/whatever from a linear search to some sort of binary search then what you've done wrong is to not write enough base classes, or to have written those classes badly.
3. Profile your code.
Fixing #1 halved our load time and fixing #2 seems to have smoothed out the occasional hiccup in my streaming code that I hadn't had time to track down yet. Doing #3 found something that was eating 15% of the frame time and then pinpointed the culprit that was eating 70% of the CPU ticks during loading .
So, without resorting to anything clever, we've dropped the load times by 65%. Now I just need to LART the bastard who wrote all that bad code...
Posted by matt at December 17, 2003 12:33 AM