Speed optimizations, finally

Tom, December 13 2006
It's so tempting but I had been avoiding it like the plague. But once I created a level ten times larger than before and saw the framerate drop from 60 to 5 FPS I knew the time has finally come.

After two hours of profiling and slight tweaks and refactorings I'm getting 60 FPS again. Eclipse with TPTP was extremely helpful; it quickly guided me to the exact lines that were hurting performance.

There were some issues that further prove that premature optimization is evil. For example the code that helps the aliens find something to attack has several layers of 'elimination' conditions. I had previously thought they were being evaluated in the right order (eliminate as many objects as possible at an early stage, then do more complex tests on the few remaining ones). But it turned out it was faster to do it the opposite way because the tests I considered complex were in fact the fastest ones.
Starting the profiling session with memory and performance analysis enabled caused the game to run below 1 FPS. For a while I thought this was caused by the profiler itself but it was in fact the memory analysis causing the slowness. I turned it off as I didn't need it anyway and the game ran as fast as normally, almost unaffected by the profiler. Surprising.
en.wikipedia.org/wiki/Opti…(computer_science)#When_to_optimize
cattleshow.net/pic/2006-06…
No HTML

Your comment

No HTML allowed. Strings that start with http:// will turn into clickable links automatically.

Spam protection. How much is two by three?

Name: Email:
Games
Devastro
Titan Attacks
Chocolate Castle
Shop
Buy Devastro
Buy more games
Newsletter
Subscribe
Unsubscribe
Blog
Latest posts
Browse all posts
Subscribe to feed
Contact
Contact us
Feedback form
Game name generator