Backtesting:
- Single-pass metrics calculation (was 10+ passes)
- Inline stats: mean, variance, win/loss counts computed together
- Combined drawdown metrics in one pass
- Removed redundant method calls
Risk Management:
- Ring buffers for trade history (O(1) vs O(n) shift/slice)
- Running sum for volatility average (O(1) vs O(n) reduce)
- Incremental loss count tracking
Reduces iteration overhead by ~5-10x for large datasets.