You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WS perf: subscribe_book iterator re-materializes the entire orderbook on every delta #244
Every orderbook_delta frame consumed via the high-level subscribe_book(ticker=...) API pays O(n log n) sort on both sides plus 2N Pydantic OrderbookLevel validations + 1 Orderbook validation per delta. For a 200-level book at 100 deltas/sec this is ~40k Decimal validations/sec per ticker, completely defeating the #199 in-place hot path the recv loop carefully preserves.
Yield a lightweight view (per-side dict[Decimal, Decimal] snapshot or a frozen sorted tuple cached on _BookState and invalidated on mutation) instead of constructing a fresh validated Orderbook model every frame; only materialize on explicit mgr.get(). Add a bench parametrized on N (levels) × frames/sec.
Activity
perf(ws): cache materialized Orderbook on _BookState (#244)
perf(ws): adopt orderbook snapshot dicts by identity (#296) (#306)
perf(ws): orderbook materialization + apply_snapshot single-copy + ze…