stock-bot/docs/development/architecture/decisions/008-performance.md

20 lines
1.6 KiB
Markdown

# ADR-008 — Performance work earns its complexity
Status: proposed; P06 requires a separate measured go/no-go.
## 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.