Delta Engine Blog

AI, Robotics, multiplatform game development and Strict programming language

Another crazy post at GameDev.net

I was just reading this post at GameDev.net Yes I'm an optimization freak and wanted to help some guy figuring out if multiplications or divisions are faster on todays CPUs. It turned into a "c++ compiler > all" war after I posted a c# example program because the c++ compiler does optimize everything out and made my performance test useless. However I also wrote a c++ version and a c++ with assembler version and the results are all the same (except in the c++ only version when the compiler cuts out all tests and returns 0ns for everything):

Each calculation is executed 1 billion times:
3.000000/2.000000=1.500000 took 3663257ns
3.000000*0.500000=1.500000 took 1366358ns
2.000000*(4.000000/5.000000)=1.600000 took 7738814ns
2.000000*0.800000=1.600000 took 1366403ns

For more info read the thread, especially if you think profiling makes no sense in debug mode (wtf? I always develop in debug mode and it helps enormously) or just a c++ > all freak. A lot of ppl will be on your side ^^
http://www.gamedev.net/community/forums/topic.asp?topic_id=366712