Day 16 of Advent of Compiler Optimisations!

Pass a function two separate arguments, or pack them in a struct — which is faster? The answer might surprise you: sometimes the struct version is MORE efficient! Eight char arguments as separate parameters spill to the stack, but pack them in a struct and they fit in a single register. How does the compiler pull this off?

Read more: xania.org/202512/16-calling-co
Watch: youtu.be/Yaw8AMoP4sI

0

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