Author Topic: C++ Optimizations  (Read 1584 times)

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19961
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
C++ Optimizations
« on: March 21, 2014, 04:08:38 PM »
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).
« Last Edit: March 21, 2014, 04:10:37 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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