Skip to content

perf: evaluate pool-backed order-book storage#96

Merged
div0rce merged 3 commits into
mainfrom
feat/m32-pool-backed-order-book-storage
Jun 2, 2026
Merged

perf: evaluate pool-backed order-book storage#96
div0rce merged 3 commits into
mainfrom
feat/m32-pool-backed-order-book-storage

Conversation

@div0rce
Copy link
Copy Markdown
Owner

@div0rce div0rce commented Jun 2, 2026

Summary

  • Adds OrderBook::Storage::{Baseline,Pooled} and MatchingEngine(OrderBook::Storage) so M32 can compare baseline order-book storage against PMR-backed node allocation.
  • Storage::Pooled uses a per-book std::pmr::unsynchronized_pool_resource for the order-book std::pmr::list, std::pmr::map, and std::pmr::unordered_map nodes.
  • Adds an engine-level storage benchmark: make bench-storage / qsl-bench storage / results/pool_backed_storage.txt.
  • Adds docs/pool_backed_storage.md and ADR 0009 documenting the storage boundary, methodology, cache/locality implications, and limitations.

Scope boundary

M32 uses PMR pool-backed node allocation. This is not direct M28 OrderPool<Capacity> integration.

Direct OrderPool<Capacity> integration would require an intrusive/custom-node order-book redesign because the current std::list<Order> allocates implementation-defined list nodes, not bare engine::Order objects. That future path is tracked separately in #95.

Correctness evidence

The new invariant test proves Baseline and Pooled are semantically identical over generated flows:

  • identical per-command event streams
  • identical aggregate event stream
  • identical final EngineSnapshot
  • identical last_seq
  • non-vacuity: trades occur and resting liquidity remains

Benchmark evidence

make bench-storage compares baseline order-book/engine storage against pooled PMR order-book/engine storage. This is an engine-level workload, not isolated allocator-only acquire/release.

The committed artifact was regenerated from source commit f0055e2 with:

  • Dirty tree: no (excluding this generated output)
  • deterministic generated engine flow, seed 42, 4 symbols, 5000 commands

The measured PMR result on this macOS/Apple-clang run is local hardware/compiler evidence only and is not a production-latency or general speedup claim.

Verification

  • make check passed, 188/188
  • make asan passed, 188/188
  • make bench-storage passed and wrote results/pool_backed_storage.txt
  • git status --short clean

@div0rce
Copy link
Copy Markdown
Owner Author

div0rce commented Jun 2, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@div0rce div0rce marked this pull request as ready for review June 2, 2026 16:48
@div0rce div0rce merged commit f122ee8 into main Jun 2, 2026
6 checks passed
@div0rce div0rce deleted the feat/m32-pool-backed-order-book-storage branch June 2, 2026 19:26
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