stock-bot/design/development/architecture/decisions/008-performance.md
2026-11-27 00:12:48 -05:00

24 lines
2.2 KiB
Markdown

# ADR-008 — Performance work earns its complexity
Status: performance work explicitly resumed by the owner, 2026-10-28. Evaluate all remaining conditional tasks using the smallest supported change; record no-go decisions for extensions without demonstrated value. P06 still needs a bounded, measured justification before a prototype.
## Sequence
1. P01 measures currently available dataset/native execution paths. Missing counters are unavailable, not zero; getters are not callback benchmarks.
2. F06 constructs sorted historical replay once and measures scaling. P02 is merged, not a second queue rewrite.
3. F07/S01 add real step/TS-decision/context-byte measurements.
4. P04 runs independent trials with the existing one-shot workers. It need not wait for resident cross-trial datasets.
5. P03 shared datasets, D04 shared feature caching and P05 detail-storage/pagination remain deferred until profiles identify meaningful repeated work.
6. P06 may prototype a tiny plan only with owner-approved budget and representative end-to-end benefit target.
## Why change the old gate
A removable20% fraction permits at most1.25x speedup; a simultaneous1.5x condition is not a useful universal rule. Record the actual fraction, Amdahl upper bound, end-to-end timings and maintenance cost. The owner chooses whether the benefit warrants a bounded prototype. No automatic language/framework project is authorized by a microbenchmark.
## Constraints
Correctness/policy hashes must match. Keep financial event processing serial within one portfolio; parallelize independent trials. No GPU/distributed scheduler/feature service/embedded JS or Arrow-everywhere conversion without evidence. Existing [queue insertion scan](../../../../apps/stock/engine/src/backtest/mod.rs#L138) is a concrete reason to choose a sorted cursor, not a reason to rewrite unrelated infrastructure.
## October 28 review outcome
P08 implements one measured local TypeScript state-handling optimization, preserving exact Rust economic hashes. D04/P03/P05/P06 remain deferred; CL21 also remains unnecessary without a concrete replay edit. No new blanket performance pause is imposed; see [benchmarks.md](../benchmarks.md) for measured figures.