Skip to content

Add hot-path allocation counter feature for benchmarking #68

@joaquinbejar

Description

@joaquinbejar

Overview

Add a feature-gated allocation counter on the hot path (ingest → execution report) to measure and report allocation count. Use a wrapper allocator or counters to identify unnecessary allocations. Gate behind feature = "alloc-counters" to avoid production overhead.

Context

  • Files: Cargo.toml, src/lib.rs, src/orderbook/operations.rs
  • Worktest requirement: "Allocation count on the hot path (should be zero or near-zero)"
  • Signal: staff-level engineering; zero-alloc paths are rare but valuable
  • Optional: CPU pinning to reduce variance

Acceptance criteria

  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo fmt --all --check clean
  • cargo test --all-features clean
  • cargo build --release clean
  • cargo test --all-features --test '*alloc*' runs without error
  • Feature flag compiles cleanly without affecting production binary size
  • Unit test: test_ingest_zero_alloc confirms allocation count ≤ expected threshold
  • BENCH.md notes allocation count alongside latency p99.99

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestperformanceHot-path optimization, benchmarks, tail latency

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions