I'm programming a game for the GP2X as part of my university course, and getting a decent framerate out of that thing isn't easy so I was wondering if people could share their thoughts on effective optimisation, specifically for games if people have that knowledge.
I know some common techniques like dirty rectangles for drawing the background, and know to avoid using sqrt and pow for example, but I do have a limited amount of experience in optimising code, in fact I had never used a profiler until a little white ago, so any nuggets of wisdom would be greatly appreciated.
Statistically, the problem always lies "somewhere else" and not where you thought. So my rule number one: use your profiler ! ;-)
"Avoiding sqrt" has no effect in most of the places. It may be your problem, but most probably it is not.
If you don't have any profiler, look at your local documentation of how to get a good time measurement function (e.g. for Windows, "QueryPerformanceCounter" is a good start). Then plaster your code with time measurement statements to get a rough idea where your code spent the most time in.
It won't be easy (especially with multi-threading or external libraries and stuff), but I think even this simple profiling skill is much much more worth the effort than knowing about sqrt, pow, fast float to int conversions, squared_length or whatever strange specialized tips you will hear in most c++ cocktail parties ;-)