Thursday, June 28, 2012 [Tweets] [Favorites]

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

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment