r/programming • • Aug 02 '26

Every byte matters

https://fzakaria.com/2026/06/01/every-byte-matters
204 Upvotes

43 comments sorted by

View all comments

Show parent comment

5

u/tryx Aug 03 '26

And that any optimisations in the codegen will impact a whole ecosystem

0

u/cdb_11 Aug 03 '26

Compilers can't willy-nilly change the codegen here, because it breaks ABI compatibility. In C and C++ in particular, the exact layout rules are defined by the platform, and the compiler must obey them. I believe the Rust and Zig spec does not specify the layout, but they reorder fields for size, which to me personally is a questionable decision. AOT compilers lack the information necessary to optimize it (the best they could do is guess, just like they do for branches vs branchless), and AFAIK JIT compilers don't even bother doing anything about it.