Advent of Compiler Optimisations 2025

2025-12-029:5138468xania.org

Today I’m announcing a project that’s been in the making for around a year. As my time off draws to a close, I’ve been working on an “Advent of” type project, to be released one a day from the 1st of…

Today I’m announcing a project that’s been in the making for around a year. As my time off draws to a close, I’ve been working on an “Advent of” type project, to be released one a day from the 1st of December until the 25th.

This December will be the Advent of Compiler Optimisations: I’ll release one blog post and video each day, each detailing a fun and interesting C or C++ optimisation that your compiler can do. I’ll go into the details of when it applies, how to interpret the assembly, and perhaps as importantly, when it doesn’t apply.

I’ll be covering some very low-level, architecture-specific tricks as well as larger, more high-level optimisations. While I mostly cover x86-64, I do touch on 64-bit and 32-bit ARM as well.

You can follow along by watching the AoCO2025 tag on this blog, subscribing to me on YouTube, or following the YouTube playlist.

It’s been a colossal amount of work, but a lot of fun too. I hope you enjoy learning how amazing compilers are as much as I do!

See you on the first of December!


Read the original article

Comments

  • By adamgordonbell 2025-12-0217:043 reply

    Matt is amazing. After checking out his compiler optimizations, maybe check out the recent interview I did with him.

        What I’ve come to believe is this: you should work at a level of abstraction you’re comfortable with, but you should also understand the layer beneath it.
    
        If you’re a C programmer, you should have some idea of how the C runtime works, and how it interacts with the operating system. You don’t need every detail, but you need enough to know what’s going on when something breaks. Because one day printf won’t work, and if the layer below is a total mystery, you won’t even know where to start looking.
    
        So: know one layer well, have working knowledge of the layer under it, and, most importantly, be aware of the shape of the layer below that.
    
    https://corecursive.com/godbolt-rule-matt-godbolt/

    Also this article in acmqueue by Matt is not new at all, but super great introduction to these types of optimizations.

    https://queue.acm.org/detail.cfm?id=3372264

  • By bspammer 2025-12-0211:57

    I really appreciate that despite being an obvious domain expert, he’s starting with the simple stuff and not jumping straight into crazy obscure parts of the x86 instruction set

  • By adev_ 2025-12-0212:411 reply

    Matt Godbolt is an absolute gem for the C & C++ community.

    Many thanks to him for that.

    Between that and compiler explorer, it is fair to say he made the world a better place for many of us, developers.

    • By cyberax 2025-12-0220:072 reply

      Wait?!? Godbolt is actually a real person!?!?

      • By ubj 2025-12-031:521 reply

        This is apparently such a common misunderstanding that it was put at the bottom of the C++ iceberg:

        https://victorpoughon.github.io/cppiceberg/

        • By cyberax 2025-12-033:00

          I used godbolt.org dozens of times, and I never bothered to look at "about".

          D'Oh.

          Sponsoring him on Github right now...

      • By mattgodbolt 2025-12-032:50

        I _think_ so, but this could all be some kind of simulation, I guess? :)

HackerNews