Thursday, June 28, 2012

Branch Prediction Fail

An interesting Stack Overflow question (via Mike Ash):

Here is a piece of code that shows some very peculiar performance. For some strange reason, sorting the data miraculously speeds up the code by almost 6x […] My first thought was that sorting brings the data into cache, but my next thought was how silly that is because the array was just generated.

Comments RSS · Twitter

Leave a Comment