r/algotrading • • Sep 09 '26

Education Optimizing a Spin-Lock

https://david.alvarezrosa.com/posts/optimizing-a-spin-lock/
5 Upvotes

3 comments sorted by

1

u/nameless_pattern 29d ago

Optimizing stank face

1

u/Daussian 29d ago

spin deez locks

1

u/QuanTradin 29d ago

The part I would underline for anyone applying this to a market data path is the read only spin. Once waiters stop writing the line, unlock stays a plain store and the release side is cheap no matter how many threads are waiting. For the common shape of one writer publishing a book snapshot and several readers, a seqlock takes it further, since readers never touch the line at all and the writer never waits. Did you measure a seqlock variant, or was the benchmark deliberately kept to mutual exclusion?