# A performance trap: when store forwarding fails

DevFeed: [A performance trap: when store forwarding fails](<https://devfeed.tech/articles/a-performance-trap-when-store-forwarding-fails-118940.md>)

Original publisher: [Read original article](<https://lemire.me/blog/2026/11/05/a-performance-trap-when-store-forwarding-fails/>)

Author: Daniel Lemire

Published: 2026-11-05T13:06:20Z

Content type: article

Language: en

Sources: [Daniel Lemire](<https://devfeed.tech/sources/daniel-lemire.md>)

Topics: [Intel Core](<https://devfeed.tech/topics/intel-core.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>)

Tags: [buffer](<https://devfeed.tech/tags/buffer.md>), [c](<https://devfeed.tech/tags/c.md>), [cache](<https://devfeed.tech/tags/cache.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [cycles](<https://devfeed.tech/tags/cycles.md>), [epyc](<https://devfeed.tech/tags/epyc.md>), [example](<https://devfeed.tech/tags/example.md>), [experiments](<https://devfeed.tech/tags/experiments.md>), [failure](<https://devfeed.tech/tags/failure.md>), [graviton](<https://devfeed.tech/tags/graviton.md>), [load](<https://devfeed.tech/tags/load.md>), [overlap](<https://devfeed.tech/tags/overlap.md>), [performance](<https://devfeed.tech/tags/performance.md>), [processor](<https://devfeed.tech/tags/processor.md>), [reading](<https://devfeed.tech/tags/reading.md>), [reload](<https://devfeed.tech/tags/reload.md>), [size](<https://devfeed.tech/tags/size.md>), [store](<https://devfeed.tech/tags/store.md>), [update](<https://devfeed.tech/tags/update.md>), [write](<https://devfeed.tech/tags/write.md>)

## AI overview

Store forwarding lets a later load obtain bytes from a store buffer before the store reaches cache, but forwarding fails when the load is wider than the store or the accessed ranges only partly overlap; the load then waits for the store to reach cache. The excerpt's C example overwrites one byte and reloads eight, and notes the same issue for a 4-byte store followed by an 8-byte load or an 8-byte load shifted four bytes from an 8-byte store. It shows avoiding the mismatch by loading eight bytes into a register, modifying the byte there, then storing all eight back. In the reported experiments, matching store/load operations took one cycle on Xeons and EPYC; wider loads took 19 cycles on Xeons, 14 on EPYC, and 5 on M4 and Graviton 5. Two stores took 8 cycles on M4. A compiler may remove a reload when the same eight bytes are stored and read back.

## Source excerpt

A store does not go straight into the cache. Waiting for that write would stall the processor. It sits in a store buffer, and a later load can take its bytes from that buffer. That is store forwarding. Forwarding works when the load is the same size as the store, or smaller and completely inside ... Continue reading A performance trap: when store forwarding fails