• Category: Engineering post
  • Status: discussion
  • Sources: write-up, HN 48889148
  • Summary: A 2026-07-12 post by purplesyringa shows a serial encoding loop dropping from 320 to 80 microseconds after wrapping a table lookup in a branch the CPU predicts as unlikely, with a volatile cast to stop the compiler removing it. The original loop was latency-bound because each iteration depended on the previous value. The added branch lets the processor speculate ahead, converting the loop from latency-bound to throughput-bound.
  • Why it matters: It is a concrete demonstration of trading a rarely-taken misprediction for instruction-level parallelism in dependency-chained loops.

Send feedback on this story