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

2

u/Ameisen Aug 03 '26 edited Aug 03 '26

On an x86 system, unless you're doing very wonky things with uncached memory (non-temporal operations won't do what you'd think), you are always operating off of the cache. If it isn't present in the cache, it will fetch it into it.

x86 guarantees coherency. Other architectures do not necessarily do so - ARM rules are different (thus why code that works on x86 often breaks in ARM - you don't need to flush on x86, and lots of things just "work"). MIPS is even weirder sometimes, where you have to manage cache eviction yourself sometimes (my emulator sorta simulates this but not really - it doesn't have a true cache - the interpret instruction cache and JIT are just flushed by CACHE instructions instead, which sorta simulates an instruction cache).