Advent of Compiler Optimisations 2025

xania.org

336 points by vismit2000 15 hours ago


adamgordonbell - 8 hours ago

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

bspammer - 13 hours ago

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

adev_ - 12 hours ago

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.

calibas - 9 hours ago

Advent of Computer Science Advent Calendars, Day 2

ketanmaheshwari - 10 hours ago

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

alberth - 11 hours ago

After 25-years of software development, I still wonder whether I’m using the best possible compiler flags.

atgreen - 8 hours ago

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.

squater - 13 hours ago

You can never have too much Godbolt!

bkallus - 9 hours ago

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.

badmonster - 6 hours ago

Advent of Code for compiler nerds. Love this format - daily bite-sized optimization lessons build intuition far better than dense textbooks. Understanding what compilers do and why they do it makes you a better programmer in any language.

alfanick - 12 hours ago

Is there a PDF somewhere? I'm not really able to follow YT videos.

filosofo_rancio - 14 hours ago

Thanks for sharing, I've always found optimizing a really interesting field, I will keep a close eye!

ktallett - 15 hours ago

This is really cool. Congrats on the quality of the work!

NooneAtAll3 - 11 hours ago

I don't understand

where is the problem to be solved?