Day 17 of Advent of Compiler Optimisations!

A function that handles both upper and lower case conversion. Call it with upper=true and the compiler inlines it — but something remarkable happens. The inlined code doesn't just avoid the function call overhead. Half the function completely vanishes! How does copy-pasting code make it disappear?

Read more: xania.org/202512/17-inlining-t
Watch: youtu.be/JFHfFTvMPp0

0

If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/mattgodbolt/statuses/115734901449854571 on your instance and quote it. (Note that quoting is not supported in Mastodon.)