HN Hall of Fame Weekly email

Beating the L1 cache with value speculation (2021)

Screenshot of mazzo.li captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 3 calendar years, with breakout response in 2 of them.

submissions
4
submitters
4
observed span
2021–2025
peak thread · 80 comments
248 pts
latest 20+ return · 2025-10-10
47 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

It's rare to need to work at this level of optimization, but this is a really neat trick! Modern cores are quite wide - capable of running 6-8 instructions at once, as long as there are no dependencies. Something as simple and common as a summation loop can often be sped up 2-4x by simply having multiple accumulators that you then combine after the loop body; this lets the processor "run ahead" without loop carried dependencies and execute multiple accumulations…

How realistic is it to have a linked list in contiguous memory that stays nicely ordered? In my experience, lists are normally cobbled together with nodes that are allocated widely separated in time and hence I have no knowledge that I can use to predict the address of the next pointer. If you're in a scenario where this optimization works, it seems like it would be better to just use an array.

I am new to this low level, but am I right in understanding this works because he uses a linked list but often it is contiguous in memory so you guess the next element is contiguous and if it is the branch predictor predicts you are right and saves going to cache and breaking the pipeline. However I imagine you'd also get the same great performance using an array?

This is just nuts

lhmiles·18-point thread·

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
2

100+ points or 50+ comments

Total points
470

reference only — not used in Hall rules or ranking

Total comments
149

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2021-07-23Beating the L1 cache with value speculationFirst breakoutrostayob15753
2024-07-11Beating the L1 cache with value speculation (2021)Best threadnickdevx24880
2025-10-07Beating the L1 cache with value speculation (2021)signa11182
2025-10-10Beating the L1 cache with value speculation (2021)Latest 20+ point returnshoo4714