17 comments

[ 3.2 ms ] story [ 44.0 ms ] thread
This is really cool. Congrats on the quality of the work!
Thanks for sharing, I've always found optimizing a really interesting field, I will keep a close eye!
You can never have too much Godbolt!
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.

Wait?!? Godbolt is actually a real person!?!?
Is there a PDF somewhere? I'm not really able to follow YT videos.
There's a link to the AoCO2025 tag for his blog posts in the op.
After 25-years of software development, I still wonder whether I’m using the best possible compiler flags.
I don't understand

where is the problem to be solved?

I am personally interested in the code amalgamation technique that SQLite uses[0]. It seems like a free 5-10% performance improvement as is claimed by SQLite folks. Be nice if he addresses it some in one of the sessions.

[0] https://sqlite.org/amalgamation.html

Advent of Computer Science Advent Calendars, Day 2
I hope he ends up covering integer division by constants. The chapter on this in Hacker's Delight is really good but a little dense for casual readers.
I'm looking forward to the remaining posts. The first thing I did this AM was teach SBCL how to optimize `(+ base (* index scale))` and `(+ base (ash index n))` patterns into single LEA instructions based on the day 2 learnings.
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