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!
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.
The “understand one layer below where you work” is something my professors at uni told us 10+ years ago. Not sure where that originated from, but I really think that benefited me in my career. I.e understanding the JVM when dealing with Java helped optimize code in a relatively heavyweight medical software package.
And also, it’s just fun to understand the lower layers.
https://cacm.acm.org/research/always-measure-one-level-deepe... This has been a classic repeat in my grad classes.
Awww thanks again Adam :blush:
My standard question to all Experts ;-)
What are some articles/books/videos that you would recommend to go from beginner-to-expert in your domain ?
I actually wrote a blog post about it and checked lower level abstractions for web developers: https://yncui.com/post/lower_level_abstractions_for_web_deve...
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
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.
This is apparently such a common misunderstanding that it was put at the bottom of the C++ iceberg:
I used godbolt.org dozens of times, and I never bothered to look at "about".
D'Oh.
Sponsoring him on Github right now...
I _think_ so, but this could all be some kind of simulation, I guess? :)