Jul 2026
Limit Order Book & Matching Engine
A stock-exchange matching engine in C++, checked against 2.8 million real NASDAQ messages. It also runs in your browser.
How it works
Cut latency without changing a single matched trade, and prove the book still matches the naive version byte for byte.
A flat O(1) price-ladder array and intrusive free-list order pool (64-byte cache-aligned levels) replace std::map + std::list, cutting median latency 538→344 ns (~1.5×) and lifting throughput to 4.0 M ops/s. The rewrite stays byte-for-byte identical to the naive book and holds up against 2.8M replayed NASDAQ ITCH messages. Compiled to WebAssembly for a live in-browser demo.