Reamer stress benchmark
Data dir: <workdir>/reamer-research/tests/stress/data

benchmark                                                elapsed       items unit         throughput
----------------------------------------------------------------------------------------------------

-- B1  CSV PARSE -------------------------------------------------------
  csv_parse deep_1m  ~1.2M rows                           0.105s      235768 bars           2238496/s  +15 MB
  csv_parse deep_4m  ~4.7M rows                           0.408s      884130 bars           2167292/s  +54 MB
  csv_parse scrambled 311k OOO                            0.025s       58942 bars           2344525/s  +7 MB
  csv_parse sparse    ~39k rows                           0.003s        7368 bars           2483194/s

-- B2  TIMELINE + ALIGNED BUILD ----------------------------------------
  timeline_union wide_10  10 tickers  589420 bars         0.004s       58942 steps         13713077/s  +6 MB
  aligned_union  wide_10  10 tickers                      0.022s       58942 steps          2676501/s  +24 MB
  timeline_union wide_20  20 tickers  1178840 bars        0.013s      153942 steps         11593431/s  +13 MB
  aligned_union  wide_20  20 tickers                      0.050s      153942 steps          3051556/s  +98 MB

-- B3  PORTFOLIO ENGINE — SINGLE-TICKER DEPTH ------------------------
  replay_depth no_brackets  235768 bars  1179 trades      0.015s      235768 bars          15941117/s  +0 MB
  replay_depth brackets     235768 bars  205 trades       0.015s      235768 bars          16130960/s

-- B4  PORTFOLIO ENGINE — MULTI-ASSET BREADTH ------------------------
  replay_breadth wide_10  10 tickers  no_brackets         0.015s       58942 steps          3989582/s
  replay_breadth wide_10  10 tickers  brackets            0.017s       58942 steps          3556763/s
  replay_breadth wide_20  20 tickers  no_brackets         0.381s      153942 steps           403989/s

-- B5  REPLAY ENGINE ---------------------------------------------------
  replay_sparse_with_position  ~93M ticks                 0.338s    17683200 ticks         52269468/s
  replay_snapshot_baseline      second_half               0.118s       29471 bars            250212/s
  replay_snapshot_after_restore second_half               0.117s       29471 bars            251159/s

-- B6  MONTE CARLO -----------------------------------------------------
  montecarlo   1000 trades ×   1000 sims                 0.004s     1000000 ops          246837274/s  +8 MB
  montecarlo  10000 trades ×  10000 sims                 0.031s   100000000 ops         3196313857/s  +756 MB
  montecarlo_streaming  10000 trades × 100000 sims       0.074s  1000000000 ops        13511484965/s  +5 MB

-- B7  END-TO-END  (COMBO: 5 tickers × ~1.2M bars) --------------------
  load:    5 tickers  1178840 total bars  0.000s
  timeline build: 235768 steps  0.017s
  backtest: 1165 trades  0.040s
  monte_carlo: 10000 curves × 4 steps  0.010s
  e2e_combo  5×1.2M bars  backtest+MC                    0.072s     1178840 bars          16263406/s  +20 MB

-- B8  SCALE — N×T PORTFOLIO BACKTEST (synthetic daily bars) --------
  scale_build   n= 50  t= 5yr  63K bars                   0.000s        1260 steps          4821453/s
  scale_backtest n= 50  t= 5yr  1250 trades               0.004s        1260 steps           334490/s
  scale_build   n= 50  t=10yr  126K bars                  0.000s        2520 steps          6122866/s
  scale_backtest n= 50  t=10yr  2500 trades               0.007s        2520 steps           336820/s
  scale_build   n= 50  t=20yr  252K bars                  0.001s        5040 steps          6010490/s
  scale_backtest n= 50  t=20yr  5050 trades               0.017s        5040 steps           304968/s
  scale_build   n= 50  t=40yr  504K bars                  0.004s       10080 steps          2405233/s
  scale_backtest n= 50  t=40yr  10100 trades              0.043s       10080 steps           235143/s
  scale_build   n=100  t= 5yr  126K bars                  0.000s        1260 steps          2822758/s
  scale_backtest n=100  t= 5yr  2500 trades               0.008s        1260 steps           154351/s
  scale_build   n=100  t=10yr  252K bars                  0.001s        2520 steps          2964514/s
  scale_backtest n=100  t=10yr  5000 trades               0.018s        2520 steps           142113/s
  scale_build   n=100  t=20yr  504K bars                  0.004s        5040 steps          1169129/s
  scale_backtest n=100  t=20yr  10100 trades              0.043s        5040 steps           116158/s
  scale_build   n=100  t=40yr  1008K bars                 0.010s       10080 steps          1033374/s
  scale_backtest n=100  t=40yr  20200 trades              0.101s       10080 steps           100108/s  +71 MB
  scale_build   n=200  t= 5yr  252K bars                  0.002s        1260 steps           570672/s
  scale_backtest n=200  t= 5yr  5000 trades               0.020s        1260 steps            63028/s
  scale_build   n=200  t=10yr  504K bars                  0.004s        2520 steps           606225/s
  scale_backtest n=200  t=10yr  10000 trades              0.047s        2520 steps            54032/s
  scale_build   n=200  t=20yr  1008K bars                 0.010s        5040 steps           503794/s
  scale_backtest n=200  t=20yr  20200 trades              0.099s        5040 steps            50775/s  +5 MB
  scale_build   n=200  t=40yr  2016K bars                 0.021s       10080 steps           484695/s
  scale_backtest n=200  t=40yr  40400 trades              0.220s       10080 steps            45867/s  +127 MB
  scale_build   n=500  t= 5yr  630K bars                  0.004s        1260 steps           292128/s  +0 MB
  scale_backtest n=500  t= 5yr  12500 trades              0.068s        1260 steps            18657/s
  scale_build   n=500  t=10yr  1260K bars                 0.009s        2520 steps           283436/s
  scale_backtest n=500  t=10yr  25000 trades              0.136s        2520 steps            18542/s  +0 MB
  scale_build   n=500  t=20yr  2520K bars                 0.023s        5040 steps           219328/s
  scale_backtest n=500  t=20yr  50500 trades              0.300s        5040 steps            16787/s  +119 MB
  scale_build   n=500  t=40yr  5040K bars                 0.047s       10080 steps           212539/s  +20 MB
  scale_backtest n=500  t=40yr  101000 trades             0.614s       10080 steps            16405/s  +304 MB

-- B9  EXTREME CAPACITY — 10k tickers × 20yr (50M bars, no threshold) 
  Generating 10000 tickers × 5040 bars = 50400000 total bars...
  gen:      2.040s  +2671 MB  (50400000 bars)
  build:    0.463s  +401 MB  (5040 steps  10881 steps/s)
  orders:   0.099s  500000 orders across 50 steps
  backtest: 9.924s  +931 MB  (5040 steps  508 steps/s  250000 trades)
  extreme_capacity  n=10k  t=20yr  50M bars               9.924s        5040 steps              508/s  +931 MB

-- B10  REALISTIC PORTFOLIO BREADTH + TP/SL BRACKETS  (no thresholds) --

  ┌─  10k × 5yr   US equity universe ─────────────────────────────────────
  │  10000 tickers × 1260 bars = 12M bars  (~0.6 GB bar data)
  │  gen:        0.462s  +102 MB
  │  build:      0.112s  +57 MB  (1260 steps  11262 steps/s)
  │  orders:     0.042s  240000 orders  (TP/SL brackets)
  │  backtest:   3.735s  +70 MB  (337 steps/s  240000 trades)
  └────────────────────────────────────────────────────────────
  b10_ 10k × 5yr   US equity universe                    3.735s        1260 steps              337/s

  ┌─  10k × 20yr  US equity universe, full depth ─────────────────────────────────────
  │  10000 tickers × 5040 bars = 50M bars  (~2.3 GB bar data)
  │  gen:        1.767s  +10 MB
  │  build:      0.394s  +0 MB  (5040 steps  12795 steps/s)
  │  orders:     0.194s  990000 orders  (TP/SL brackets)
  │  backtest:  15.797s  +990 MB  (319 steps/s  990000 trades)
  └────────────────────────────────────────────────────────────
  b10_ 10k × 20yr  US equity universe, full depth       15.797s        5040 steps              319/s

-- BOTTLENECK SUMMARY --------------------------------------------------
  All metrics above threshold — no bottlenecks detected.

