views:

73

answers:

2

I am making a game for windows, mac and GNU, I can built it on windows already with MSVC and MingW...

But I am not finding good information regarding how much compilers optmize.

So what compiler, and options on that compiler, I can use to make my Windows version blazing fast?

Currently the profilers are showing some worring results like good portion of CPU time for example being wasted doing simple floating point math, and on the lua garbage collector.

EDIT: I am doing other stuff too... I am asking this question specifically about compilers, because the question is supposed to be one thing, and not several :)

Also, any minor speed improvement is good, specially with VSync turned on, a 1 frame per second drop at 60 FPS is sufficient to cause the game to run at 30 FPS to maintain sync.

+3  A: 

First of all, don't expect compiler optimizations to make a huge difference. You can rarely expect more than a 15 or possibly 20% difference between compilers (as long as you don't try to compare one with all optimizations turn on to another with optimization completely disabled).

That said, the best (especially for F.P. math) tends to be Intel's. It's pretty much the standard that (at best) others attempt to match (and usually, truth be told, that attempt fails). Exact options to get optimal performance vary -- if there was one set that was consistently best, they probably wouldn't include the other possibilities.

I'd emphasize, however, that to get a really substantial difference, you're probably going to need to rewrite some code, not just recompile.

Jerry Coffin
True, often optimization is in the 10-20% range, but I have seen it in the 200-300% range as well. All depends on the code and the compiler. I agree the compiler is not going to fix all the problems, leave the optimizer enabled, -O2 for gcc, and focus on your code.
dwelch
+1  A: 

Having said that compilers can't help enough, you might want to consider fixed-point arithmetic. I have seen fixed point giving reasonable improvements on X86 and POWERPCs, over FP math. Fortunately, I could find a SO discussion on this topic.

Sundar