Branch Prediction strange results
bearophile
bearophileHUGS at lycos.com
Tue Nov 11 12:15:26 PST 2008
I have found an interesting small article about optimization, so I've tried the code in C and D, and I have found strange results (the D code shows timings opposite of the article).
This is the article, look at the "Branch Prediction" section:
http://www.ddj.com/184405848
The C code:
http://codepad.org/QSGIije4
And its asm (MinGW 4.2.1):
http://codepad.org/c7ZRiXGI
The similar D code:
http://codepad.org/slhcSJEA
Its asm (DMD 1.036):
http://codepad.org/AjlraEs9
There is also about 2X performance difference.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list