{"id":5207,"date":"2012-06-28T13:54:25","date_gmt":"2012-06-28T18:54:25","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=5207"},"modified":"2012-06-28T13:54:27","modified_gmt":"2012-06-28T18:54:27","slug":"branch-prediction-fail","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2012\/06\/28\/branch-prediction-fail\/","title":{"rendered":"Branch Prediction Fail"},"content":{"rendered":"<p>An interesting <a href=\"http:\/\/stackoverflow.com\/questions\/11227809\/why-is-processing-a-sorted-array-faster-than-an-unsorted-array\">Stack Overflow question<\/a> (via <a href=\"https:\/\/twitter.com\/mikeash\/status\/218092098438692865\">Mike Ash<\/a>):<\/p>\n<blockquote cite=\"http:\/\/stackoverflow.com\/questions\/11227809\/why-is-processing-a-sorted-array-faster-than-an-unsorted-array\"><p>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 [&#8230;] 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.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>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 [&#8230;] My first thought was that sorting brings the data into cache, but my next thought was how silly that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-5207","post","type-post","status-publish","format-standard","hentry","category-programming-category"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/5207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=5207"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/5207\/revisions"}],"predecessor-version":[{"id":5209,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/5207\/revisions\/5209"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=5207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=5207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=5207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}