Skip to content

Use compact valuation mark columns#52

Merged
tradingexpert merged 1 commit into
mainfrom
feature/compact-valuation-marks
May 19, 2026
Merged

Use compact valuation mark columns#52
tradingexpert merged 1 commit into
mainfrom
feature/compact-valuation-marks

Conversation

@tradingexpert
Copy link
Copy Markdown
Owner

Summary

  • return C++ replay valuation marks as compact int64 byte columns instead of one MarkRow object per mark
  • add CompiledValuationMarks and teach equity-curve construction to consume compact marks directly
  • keep ReplayResult.equity_curve public output unchanged while avoiding intermediate ValuationMark object churn
  • extend benchmarks with CppMatchingEngine batch+marks so the audited replay cost is easier to explain

Benchmarks

Direct engine:

  • MatchingEngine scalar: 1,774,050 events/s
  • CppMatchingEngine per-event: 1,844,263 events/s
  • CppMatchingEngine batch: 16,980,531 events/s
  • CppMatchingEngine batch+marks: 18,012,722 events/s
  • batch+marks speedup vs Python: 10.15x

Full audited replay:

  • Replay + Python engine: 374,845 events/s
  • Replay + default engine: 561,666 events/s
  • default engine speedup vs Python: 1.50x

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
  • python -m benchmarks.engine_throughput
  • python -m benchmarks.replay_throughput

Coverage: 98.27% total.

@tradingexpert tradingexpert self-assigned this May 19, 2026
@tradingexpert tradingexpert merged commit a5c2887 into main May 19, 2026
8 checks passed
@tradingexpert tradingexpert deleted the feature/compact-valuation-marks branch May 20, 2026 10:27
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