Day 12 of Advent of Compiler Optimisations!

Your loop checks the same condition every iteration, even though it never changes. Seems wasteful, right? The compiler thinks so too—and its solution is something that sounds completely backwards. Making your code bigger to make it faster? What's the trick?

Read more: xania.org/202512/12-loop-unswi
Watch: youtu.be/-VCrYshE7iQ

0

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