Matt Godbolt's CppCon 2017 talk shows what modern compilers do with your C++ code, using Compiler Explorer to inspect generated assembly. It covers surprising optimizations and how the tool works.
Why Hacker News points people here: HN recommends it as an entertaining, mind-blowing look at compiler cleverness from a great speaker.
“Both are great presentations going into details on some of the crazy optimizations compilers will do.”HN comment, 2019
“Matt Godbolt is a great speaker as well. I loved this talk”
Great speaker covering Compiler Explorer architecture and compiler tricks.
Full comment
Matt Godbolt is a great speaker as well. I loved this talk that included a bit about the architecture behind his Compiler Explorer. The rest of his talk is super cool as well. E.g. closed form solutions from O(n) code? Compilers are awesome. this video
Strongly recommendssnailmailmanSep 2019
“I highly recommend Matt Godbolt's talk”
Mind-blowing compiler optimizations explained in detail.
Full comment
I highly recommend Matt Godbolt's talk "What has my compiler done for me lately?"[0] and its follow-up[1]. Both are great presentations going into details on some of the crazy optimizations compilers will do. As someone who knows very little about the inner workings of compilers my mind was blown when I saw some them. [0] this video [1] link
RecommendspkayeJan 2018
“Pretty amazing stuff.”
Shows surprising compiler optimizations in GCC and Clang, like popcount.
Full comment
You should check out this presentation done by Matt Godbolt about compiler internals. He talks about what kind of optimizations are being done by GCC and Clang. Pretty amazing stuff. For example, the compiler will figure out you are trying to write a pop count in high level code and replace it with a single popcount instruction. this video
RecommendshighesttideOct 2018
“Entertaining talk, not extremely in depth, though.”
Entertaining talk on what compilers do, not deeply technical.
Full comment
What has my compiler done for me lately? - Matt Godbolt this video Entertaining talk, not extremely in depth, though.
RecommendsdrejOct 2018
“CppCon has super interesting content.”
Interesting CppCon talk even for non-C++ programmers.
Full comment
CppCon has super interesting content. That comes from a person who has written maybe two dozen lines of C++ code, mostly just hello world. E.g. this talk by Matt Godbolt or anything by Chadler Carruth. this video
Recommendsfps_dougSep 2019
“I recommend Matt Godbolt's Talk(s) about compiler cleverness”
Shows how clever compilers are, including multiplication optimizations.
Full comment
But please keep in mind that today's compilers are (most of the time) very smart. Hacker's Delight is somewhat outdated today. There's no need anymore for writing "x << 2" instead of "x * 4". I recommend Matt Godbolt's Talk(s) about compiler cleverness: this video (see the 30 minute mark for the multiplication example)
RecommendsmanaskarekarApr 2020
“this great talk by Matt Godbolt from CppCon 2017”
Great talk on what compilers do for you.
Full comment
Tangent, but this reminds me of this great talk by Matt Godbolt from CppCon 2017: “What Has My Compiler Done for Me Lately? Unbolting the Compiler's Lid” this video . And the follow up link .
Recommendss3cur3Mar 2021
“Link to the (great) CppCon talk”
Great CppCon talk on what compilers can optimize.
Full comment
Link to the (great) CppCon talk: this video The one thing I would say is: as you dig more into C++ perf, you can develop an intuition for the kinds of things the compiler can and can't optimize. For instance, the C++ example from the article uses `std::unordered_map`, which is just an absolute mess from a cache locality perspective—the best compilers today (or of the foreseeable future) can't do a thing to fix that. Improving the programmer's choice of data structure is just not on the radar. :(
Cites itfoxrob92Dec 2018
“Matt Godbolt has spoken a bit about the architecture of Compiler Explorer.”
Godbolt describes Compiler Explorer's architecture and security thinking.
Full comment
Doesn't look like it works any more. In any case, Matt Godbolt has spoken a bit about the architecture of Compiler Explorer. Seems like he's given some thought to security. this videolink
Cites itbluecheese33Sep 2019
“clang replaces a loop summing integers 0..i with the closed form version”
Example of clang turning a summation loop into a closed form.
Full comment
There's a neat example in [1] where clang replaces a loop summing integers 0..i with the closed form version. [1] this video
Cites itdrejAug 2020
“Surprisingly simple and cheap.”
Godbolt explains how Compiler Explorer works.
Full comment
If you are wondering how it works, here is Matt Godbolt himself explaining it. Surprisingly simple and cheap. this video
Cites itSimran-BOct 2022
“The Compiler Explorer backstory starts here”
Where the Compiler Explorer backstory begins.
Full comment
It's the CppCon 2017 talk with the title "What has my compiler done for me lately? Unbolting the compiler's lid". The Compiler Explorer backstory starts here: this video