Regression in untouched code: debugging an L1 I-cache associativity issue

2026-05-21

Link: https://blog.andr2i.com/posts/2026-05-19-a-regression-in-code-i-didn-t-touch

HN Discussion: 1 points, 0 comments

Every working programmer has been bitten by the impossible bug: code that hasn't been touched in months suddenly slows down or breaks after a seemingly unrelated change. Usually we shrug, blame the build cache, and move on. This post does the rare and valuable thing of chasing the rabbit all the way down to the silicon.

Based on the title, the author traces a performance regression in untouched code to an L1 instruction-cache associativity conflict. For readers who haven't thought about cache architecture since university, here's why that's a fascinating culprit:

This is the kind of bug that makes you question your sanity. Your diff is empty. Your benchmarks regressed. The compiler version didn't change. And yet the CPU is quietly evicting your hottest instructions on every loop iteration because the linker decided to lay out your code two bytes differently.

What makes posts like this valuable for a technical audience:

If you've ever wondered why -falign-functions exists, why some teams obsess over link order, or why Facebook built tools like BOLT to reorder hot code after profiling — this is the underlying phenomenon that motivates all of it.

Why it deserves more upvotes: A meticulously-debugged real-world story about CPU microarchitecture biting userland code is exactly the kind of deep-systems content HN was built for, yet it sits at one point.

All newsletters