{"id":509885,"date":"2026-06-25T04:42:10","date_gmt":"2026-06-25T04:42:10","guid":{"rendered":"https:\/\/www.newsbeep.com\/il\/509885\/"},"modified":"2026-06-25T04:42:10","modified_gmt":"2026-06-25T04:42:10","slug":"someone-changed-one-line-in-the-gcc-compiler-and-scored-a-12-improvement-on-modern-intel-and-amd-chips","status":"publish","type":"post","link":"https:\/\/www.newsbeep.com\/il\/509885\/","title":{"rendered":"Someone changed one line in the GCC compiler and scored a 12% improvement on modern Intel and AMD chips"},"content":{"rendered":"<p>                    Summary<\/p>\n<p>                                        Adding 3 to GCC&#8217;s branch-misprediction scale makes it warier of branch mispredictions.<\/p>\n<p>                                        SPEC CPU 2017 NAB test showed ~12% speedup on modern AMD and Intel CPUs.<\/p>\n<p>                                        The change is due to arrive in GCC 17, coming in 2027.<\/p>\n<p>It has been a weird month for really small code adjustments that score noticeable performance wins. It was only a few days ago that we learned that <a href=\"https:\/\/www.xda-developers.com\/someone-moved-three-lines-of-code-in-linux-72-and-got-a-5-storage-speed-boost\/\" target=\"_blank\" rel=\"nofollow noopener\">someone modified three lines of code in the Linux kernel<\/a> and achieved a 5% storage speed boost because of it. Now, someone has stepped forward and claimed that a single line change in the GCC compiler added a 12% performance boost for modern AMD and Intel chips in a SPEC CPU 2017 benchmark.<\/p>\n<p>                        Adding 3 to a variable scored big wins for new AMD and Intel processors<\/p>\n<p>            In all fairness, it was a very impactful addition of 3 <\/p>\n<p>        <img width=\"1650\" height=\"1104\" loading=\"lazy\" decoding=\"async\" alt=\"An image of a person holding an AMD Ryzen 7 7700 chip.\" data-img-url=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2026\/06\/amd-ryzen-7-7700-intel-cpu.jpg\" src=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2026\/06\/amd-ryzen-7-7700-intel-cpu.jpg\" class=\"img-brightness-opt-out\"\/><\/p>\n<p>As spotted by <a href=\"https:\/\/www.phoronix.com\/news\/GCC-x86-Generic-Mispredict\" rel=\"noopener noreferrer nofollow\" target=\"_blank\">Phoronix<\/a>, Intel software engineer Lili Cui has found a way to squeeze out more performance with minimal changes to the GCC compiler. The exact process Cui used to get this additional performance is a little complex, so let&#8217;s break it down.<\/p>\n<p>When a CPU runs code, it tries to &#8220;cheat&#8221; to boost its performance. When a CPU encounters a decision in the code (such as an if\/else statement), it &#8216;should&#8217; wait for the calculations to tell it which road to take. However, with a process called &#8220;speculative execution,&#8221; the CPU predicts which way the program will take and begins processing the subsequent code ahead of time.<\/p>\n<p>It&#8217;s sort of like sending a text to your friend asking if they want to eat a burger or a pizza, then predicting they&#8217;ll want a burger and getting a patty on the grill. If you&#8217;re right, you can get the burger cooked faster and impress your friend with your speed. If you&#8217;re wrong, you have to stop, clean everything up, and cook a pizza instead. Similarly, an incorrect guess from the CPU means it has to go back to the decision and take the other path.<\/p>\n<p>This is called a &#8220;branch misprediction,&#8221; and <a href=\"https:\/\/gcc.gnu.org\/git\/?p=gcc.git;a=commit;h=52cd02606b906160bf47001a00b446c35d46f15f\" rel=\"noopener noreferrer nofollow\" target=\"_blank\">Cui noticed<\/a> that performing them on modern CPUs costs more performance than people first assumed:<\/p>\n<p>Modern CPUs have deeper pipelines, making branch mispredictions more expensive. Increasing this cost encourages if-conversion, avoiding pipeline stalls from mispredicted branches.<\/p>\n<p>To fix this, Cui modified the line of code that defined the branch misprediction scale, which GCC&#8217;s internal code-generation math uses to gauge if it&#8217;s worth the risk to gamble on a branch. All Cui did was add 3 to the scale, and now the compiler is a lot warier about generating standard branching code. This makes it more likely to optimise the code another way, such as with a branchless sequence.<\/p>\n<p>Once done, Cui put their processors through a SPEC CPU 2017 benchmark called the 544.nab_r Nucleic Acid Builder (NAB), which calculates the physics and chemistry of molecules. Cui noted a 12% increase in performance for both Intel and AMD chips, as they spent less time backtracking and more time churning through code.<\/p>\n<p>It&#8217;ll be a while until we see this change, as it&#8217;s merged for GCC 17, releasing next year. However, it&#8217;s a cool story about how one little tweak can make a huge difference.<\/p>\n<p>                                                                                                                            <a href=\"https:\/\/www.xda-developers.com\/bios-tweaks-that-reduce-power-and-temps\/\" rel=\"nofollow noopener\" target=\"_blank\"><br \/>\n                        <img width=\"440\" height=\"248\" loading=\"lazy\" decoding=\"async\" alt=\"The Bequiet rich CPU cooler.\" data-img-url=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2026\/06\/rich-be-quiet-pc-2025-cpu-cooler.jpg\" src=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2026\/06\/rich-be-quiet-pc-2025-cpu-cooler.jpg\"\/><\/p>\n<p>                    <\/a><\/p>\n<p>                    Related<\/p>\n<p>\t\t<a href=\"https:\/\/www.xda-developers.com\/bios-tweaks-that-reduce-power-and-temps\/\" title=\"5 hidden BIOS tweaks to slash your power usage and temperatures\" target=\"_blank\" rel=\"nofollow noopener\"><br \/>\n\t\t\t5 hidden BIOS tweaks to slash your power usage and temperatures<br \/>\n\t\t<\/a><\/p>\n<p class=\"display-card-excerpt\">Achieve a cooler system without losing performance<\/p>\n","protected":false},"excerpt":{"rendered":"Summary Adding 3 to GCC&#8217;s branch-misprediction scale makes it warier of branch mispredictions. SPEC CPU 2017 NAB test&hellip;\n","protected":false},"author":2,"featured_media":509886,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[85,46,125],"class_list":["post-509885","post","type-post","status-publish","format-standard","has-post-thumbnail","category-technology","tag-il","tag-israel","tag-technology"],"_links":{"self":[{"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/posts\/509885","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/comments?post=509885"}],"version-history":[{"count":0,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/posts\/509885\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/media\/509886"}],"wp:attachment":[{"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/media?parent=509885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/categories?post=509885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/tags?post=509885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}