A high-performance C++ Order Matching Engine designed for low-latency trading simulations. This V1 implementation focuses on strict Price-Time priority matching using standard STL containers with an eye toward future custom memory optimizations.
The following benchmarks were conducted on a 12-core CPU @ 2611 MHz. Results show the throughput in items per second.
| Benchmark | Debug Mode (with tracking) | Release Mode (Optimized) |
|---|---|---|
| Add Order | 645.16 k/s | 4.64 M/s |
| Cancel Order | 2.04 M/s | 14.55 M/s |
| Modify Order | 1.01 M/s | 8.00 M/s |
| Mixed Workload | 767.39 k/s | 6.04 M/s |
Note
Debug mode includes additional integrity tracking and assertions which are disabled in the Release build for maximum performance.
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
./benchmarks/Release/run_benchmarks.exeOrderMatcher/
├── benchmarks/ # Performance testing suite & helpers
│ ├── BenchmarkHelpers.hpp
│ └── bench_orderbook.cpp
├── data/ # Project data & sample orders
├── design_decisions.md # Tactical design documentation
├── engine/ # Engine orchestration logic
├── orderbook/ # Core matching implementation
│ ├── include/ # Headers (orderbook.hpp, order.hpp)
│ └── src/ # Implementation (orderbook.cpp)
├── src/ # Project entry point (main.cpp)
├── tests/ # Unit testing suite (tests.cpp)
├── CMakeLists.txt # Build configuration
├── README.md # Project overview & benchmarks
└── v1.md # Architecture & milestones