C++ Optimizations

Started by Blizzard, March 21, 2014, 09:08:38 am

Previous topic - Next topic

Blizzard

March 21, 2014, 09:08:38 am Last Edit: March 21, 2014, 09:10:37 am by Blizzard
I was researching general optimization in C++ and I found 2 very interesting articles/books/websites that offer a lot of useful information on optimizing C++ code.

http://www.tantalon.com/pete/cppopt/main.htm
http://en.wikibooks.org/wiki/Optimizing_C%2B%2B

Both articles cover similar techniques, but I think that the latter one covers some additional stuff. I knew most of these techniques, except for a few very exotic ones. But I have to admit that I was surprised by the heavy speedup when using templates with constants (e.g. factorial calculation), omitting vtable initializations (useful with abstract/pure virtual classes) and that prefix increment/decrement operators are faster than postfix ones (++i is faster than i++, especially when implementing the operator in a class).
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.