Order Matching Engine
A low-latency order book and matching engine built in C++, benchmarked at sub-microsecond match times.
Why I built this
I wanted to understand what actually happens inside an exchange's matching core — not the theory, the actual cache-line-level decisions that separate a 2μs match from a 200ns one.
Approach
Built a price-time priority order book using intrusive linked lists to avoid allocator overhead on the hot path. Matching logic runs single-threaded per symbol shard, with lock-free SPSC queues moving orders in from the network layer.
Results
Sustained ~1.2M orders/sec on a single core, with p99 match latency under 800ns on warmed caches.
What I'd do differently
I'd profile the memory layout earlier — I spent two weeks over-optimizing matching logic before realizing cache misses on order lookups were the actual bottleneck.