Skip to content

Use compiled batches in replay advancement#51

Merged
tradingexpert merged 1 commit into
mainfrom
feature/boundary-batched-replay
May 19, 2026
Merged

Use compiled batches in replay advancement#51
tradingexpert merged 1 commit into
mainfrom
feature/boundary-batched-replay

Conversation

@tradingexpert
Copy link
Copy Markdown
Owner

Summary

  • add a C++ batch method that returns passive fills plus midpoint valuation marks
  • make ReplayGateway.advance_to(...) use compiled batches when the engine supports them, with the existing scalar Python fallback preserved
  • keep per-event valuation mark semantics while improving ordinary audited replay throughput
  • rename the direct C++ per-event benchmark wording so it is clearly a compatibility baseline, not the fast path

Local Benchmarks

Direct engine:

  • MatchingEngine scalar: 1,777,556 events/s
  • CppMatchingEngine per-event: 1,857,812 events/s
  • CppMatchingEngine batch: 15,964,170 events/s
  • batch C++ speedup vs Python: 8.98x

Full audited replay:

  • Replay + Python engine: 359,297 events/s
  • Replay + default engine: 447,789 events/s
  • default engine speedup vs Python: 1.25x

Tests

  • python -m pip install -e ".[dev]"
  • python -m ruff check .
  • python -m pytest
  • mkdir -p build/cpp && c++ -std=c++17 -Wall -Wextra -pedantic -Icpp cpp/tests/matching_engine_core_test.cpp -o build/cpp/matching_engine_core_test && build/cpp/matching_engine_core_test

Coverage: 98.20% total.

@tradingexpert tradingexpert merged commit 759bc3f into main May 19, 2026
8 checks passed
@tradingexpert tradingexpert deleted the feature/boundary-batched-replay branch May 19, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant