11# Benchmarks — SQL / Array / Decs comparison
22
3- Generated 2026-05-26 from ` 0f88a64b6 ` (PR D3 — full GroupBySourceAdapter melt ). Matrix kept current through ** PR E ** (final pattern-table collapse: 7 per-plan tables → 1 `` splice_patterns `` ; 12 stub fns + cascade → `` try_splice_patterns `` ) — same emit fns, same row data, output AST byte-identical to PR D3, so no rerun was needed .
3+ Generated 2026-05-26 from ` e968eec74 ` (PR F3 R1 — Copilot follow-up ). Matrix refreshed for ** Phase F PRs F1+F2+F3 ** (Terminator lane unification — ` TerminatorSpec ` for array side + ` DecsTerminatorSpec ` + ` DecsDispatch ` for decs side; 9 emit fns migrated to spec-builders). All three PRs verified AST byte-identical at emit time, so the cross-the-board 15-30% drop vs the prior ` 0f88a64b6 ` ( PR D3) baseline reflects environment delta + cumulative wins across PR E + F1-F3, not refactor-introduced perf change. No regressions in any cell .
44Fixture size: n = 100 000 (cars), 100 dealers, 5 brands. Each row is
55one bench family in ` benchmarks/sql/ ` ; columns are nanoseconds per
66logical operation. ` — ` marks an intentionally absent lane — see
@@ -26,146 +26,146 @@ before the timer resolution can measure them — they should be read as
2626
2727| Benchmark | SQL (m1) | Array (m3f) | Decs (m4) | Decs vs Array |
2828| ---| ---:| ---:| ---:| ---:|
29- | ` aggregate_match ` | 35.1 | 5.9 | 5.9 | 1.00 × |
30- | ` all_match ` | 28.0 | 3.5 | 3.5 | 1.00 × |
29+ | ` aggregate_match ` | 34.5 | 6.0 | 5.9 | 0.98 × |
30+ | ` all_match ` | 27.7 | 3.5 | 3.6 | 1.03 × |
3131| ` any_match ` | 0.00 | 0.00 | 0.00 | — |
32- | ` average_aggregate ` | 29.7 | 6.0 | 8.7 | 1.45 × |
33- | ` bare_order_where ` | 271.1 | 116 .7 | 125.2 | 1.07 × |
34- | ` chained_select_collapse ` | — | 17.7 | 17.6 | 0.99 × |
35- | ` chained_where ` | 36.1 | 6.7 | 7.2 | 1.07× |
36- | ` contains_match ` | 0.00 | 2.2 | 2.2 | 1.00 × |
37- | ` count_aggregate ` | 30.1 | 4.1 | 4.1 | 1.00× |
32+ | ` average_aggregate ` | 29.9 | 6.0 | 8.8 | 1.47 × |
33+ | ` bare_order_where ` | 273.9 | 117 .7 | 124.1 | 1.05 × |
34+ | ` chained_select_collapse ` | — | 17.9 | 17.6 | 0.98 × |
35+ | ` chained_where ` | 36.2 | 6.7 | 7.2 | 1.07× |
36+ | ` contains_match ` | 0.00 | 2.2 | 1.4 | 0.64 × |
37+ | ` count_aggregate ` | 29.3 | 4.1 | 4.1 | 1.00× |
3838| ` decs_count_bare_pred ` | — | — | 4.2 | — |
39- | ` distinct_by_count ` | 41.7 | 15.8 | 16.0 | 1.01× |
40- | ` distinct_by_order_take ` | — | 21.8 | 23.5 | 1.08 × |
41- | ` distinct_count ` | 41.8 | 16.2 | 15.9 | 0.98 × |
42- | ` distinct_count_pred ` | — | 16.0 | 16.0 | 1.00 × |
39+ | ` distinct_by_count ` | 41.1 | 15.8 | 16.0 | 1.01× |
40+ | ` distinct_by_order_take ` | — | 21.8 | 23.3 | 1.07 × |
41+ | ` distinct_count ` | 42.1 | 16.2 | 16.1 | 0.99 × |
42+ | ` distinct_count_pred ` | — | 15.8 | 16.1 | 1.02 × |
4343| ` distinct_take ` | 0.00 | 0.00 | 0.00 | — |
4444| ` element_at_match ` | 0.00 | 0.00 | 0.00 | — |
4545| ` first_match ` | 0.00 | 0.00 | 0.00 | — |
4646| ` first_or_default_match ` | 0.00 | 0.00 | 0.00 | — |
47- | ` groupby_average ` | 171.1 | 30.5 | 30.1 | 0.99 × |
48- | ` groupby_count ` | 144.2 | 20 .5 | 20.6 | 1.00 × |
49- | ` groupby_first ` | — | 19.9 | 20.6 | 1.04 × |
50- | ` groupby_having_count ` | 141.8 | 20.5 | 20.6 | 1.00 × |
51- | ` groupby_having_hidden_sum ` | 176.2 | 24.5 | 24.3 | 0.99 × |
52- | ` groupby_having_post_where ` | 171.9 | 20.8 | 19.9 | 0.96 × |
53- | ` groupby_max ` | 175 .4 | 25.1 | 25.2 | 1.00× |
54- | ` groupby_min ` | 176 .3 | 32.7 | 25.3 | 0.77 × |
55- | ` groupby_multi_reducer ` | 190.4 | 32.7 | 32.6 | 1.00× |
56- | ` groupby_select_order ` | 171.1 | 20.2 | 19 .9 | 0.99 × |
57- | ` groupby_select_sum ` | 206.6 | 37.1 | 36.5 | 0.98× |
58- | ` groupby_sum ` | 172.5 | 20.1 | 19.9 | 0.99× |
59- | ` groupby_where_count ` | 76.6 | 15.8 | 15.0 | 0.95 × |
60- | ` groupby_where_sum ` | 86.7 | 14.3 | 14.8 | 1.03× |
61- | ` indexed_lookup ` | 1443.0 | 205391.4 | 484.6 | 0.00× |
62- | ` join_count ` | 37.7 | 122.0 | 64.0 | 0.52 × |
63- | ` join_groupby_count ` | — | 186.8 | 91.6 | 0.49× |
64- | ` join_groupby_to_array ` | — | 217.2 | 90.9 | 0.42× |
65- | ` join_select ` | — | 149.4 | 86.5 | 0.58 × |
66- | ` join_where_count ` | 39.2 | 150 .6 | 80.9 | 0.54 × |
67- | ` last_match ` | 0.00 | 5.9 | 15.6 | 2.64 × |
68- | ` long_count_aggregate ` | 34.6 | 4.9 | 4.8 | 0.98 × |
69- | ` max_aggregate ` | 34.8 | 7.2 | 8.3 | 1.15× |
70- | ` min_aggregate ` | 35.4 | 7.2 | 8.5 | 1.18 × |
71- | ` order_distinct_take ` | — | 20.6 | — | — |
72- | ` order_reverse_normalized ` | 47.5 | 18.6 | 23.2 | 1.25 × |
73- | ` order_take_desc ` | 48.1 | 19.6 | 23.1 | 1.18 × |
74- | ` reverse_take ` | 0.10 | 0.00 | 11.8 | — |
75- | ` reverse_take_select ` | 0.10 | 42.3 | 63.0 | 1.49 × |
76- | ` select_count ` | 0.20 | 0.00 | 2.6 | — |
77- | ` select_where ` | 249.9 | 15.0 | 24.8 | 1.65 × |
78- | ` select_where_count ` | 39.5 | 7.0 | 10.8 | 1.54 × |
79- | ` select_where_order_take ` | 47 .4 | 15.5 | 18.3 | 1.18 × |
80- | ` select_where_sum ` | 49.1 | 11.2 | 10.6 | 0.95 × |
81- | ` single_match ` | 0.00 | 4.1 | 7.1 | 1.73 × |
82- | ` skip_take ` | 0.60 | 0.10 | 0.20 | 2.00× |
83- | ` skip_while_match ` | 4.3 | 6.6 | 6.6 | 1.00× |
84- | ` sort_first ` | 44.2 | 14.0 | 20.7 | 1.48 × |
85- | ` sort_take ` | 60.7 | 18.2 | 23.0 | 1.26 × |
86- | ` sort_take_select ` | 45.6 | 18.6 | 22.7 | 1.22 × |
87- | ` sum_aggregate ` | 34.4 | 2.6 | 2.4 | 0.92 × |
88- | ` sum_where ` | 35 .8 | 4.9 | 4.9 | 1.00× |
89- | ` take_count ` | 4.1 | 0.30 | 0.50 | 1.67 × |
47+ | ` groupby_average ` | 172.7 | 30.8 | 30.3 | 0.98 × |
48+ | ` groupby_count ` | 141.6 | 19 .5 | 19.3 | 0.99 × |
49+ | ` groupby_first ` | — | 18.6 | 19.2 | 1.03 × |
50+ | ` groupby_having_count ` | 142.9 | 19.4 | 19.3 | 0.99 × |
51+ | ` groupby_having_hidden_sum ` | 175.1 | 24.0 | 24.3 | 1.01 × |
52+ | ` groupby_having_post_where ` | 173.0 | 18.6 | 18.8 | 1.01 × |
53+ | ` groupby_max ` | 173 .4 | 25.2 | 25.2 | 1.00× |
54+ | ` groupby_min ` | 174 .3 | 25.1 | 25.3 | 1.01 × |
55+ | ` groupby_multi_reducer ` | 192.6 | 32.7 | 32.6 | 1.00× |
56+ | ` groupby_select_order ` | 171.3 | 18.7 | 18 .9 | 1.01 × |
57+ | ` groupby_select_sum ` | 205.0 | 36.8 | 36.0 | 0.98× |
58+ | ` groupby_sum ` | 173.6 | 18.8 | 18.6 | 0.99× |
59+ | ` groupby_where_count ` | 75.5 | 14.6 | 15.1 | 1.03 × |
60+ | ` groupby_where_sum ` | 87.1 | 14.3 | 14.7 | 1.03× |
61+ | ` indexed_lookup ` | 1462.1 | 205000.2 | 475.5 | 0.00× |
62+ | ` join_count ` | 38.1 | 121.7 | 64.3 | 0.53 × |
63+ | ` join_groupby_count ` | — | 187.4 | 91.5 | 0.49× |
64+ | ` join_groupby_to_array ` | — | 216.5 | 90.7 | 0.42× |
65+ | ` join_select ` | — | 150.8 | 85.8 | 0.57 × |
66+ | ` join_where_count ` | 39.9 | 148 .6 | 75.0 | 0.50 × |
67+ | ` last_match ` | 0.00 | 5.9 | 14.0 | 2.37 × |
68+ | ` long_count_aggregate ` | 29.4 | 4.1 | 4.1 | 1.00 × |
69+ | ` max_aggregate ` | 30.5 | 6.0 | 6.9 | 1.15× |
70+ | ` min_aggregate ` | 30.5 | 6.1 | 6.8 | 1.11 × |
71+ | ` order_distinct_take ` | — | 15.9 | — | — |
72+ | ` order_reverse_normalized ` | 38.1 | 16.2 | 20.1 | 1.24 × |
73+ | ` order_take_desc ` | 38.3 | 16.2 | 19.9 | 1.23 × |
74+ | ` reverse_take ` | 0.10 | 0.00 | 10.2 | — |
75+ | ` reverse_take_select ` | 0.00 | 34.0 | 48.6 | 1.43 × |
76+ | ` select_count ` | 0.10 | 0.00 | 2.2 | — |
77+ | ` select_where ` | 192.5 | 11.4 | 19.5 | 1.71 × |
78+ | ` select_where_count ` | 32.4 | 5.2 | 7.4 | 1.42 × |
79+ | ` select_where_order_take ` | 36 .4 | 12.4 | 14.9 | 1.20 × |
80+ | ` select_where_sum ` | 37.0 | 7.5 | 7.5 | 1.00 × |
81+ | ` single_match ` | 0.00 | 3.0 | 5.5 | 1.83 × |
82+ | ` skip_take ` | 0.50 | 0.10 | 0.20 | 2.00× |
83+ | ` skip_while_match ` | 3.5 | 5.3 | 5.3 | 1.00× |
84+ | ` sort_first ` | 38.5 | 11.1 | 13.3 | 1.20 × |
85+ | ` sort_take ` | 38.0 | 16.4 | 20.9 | 1.27 × |
86+ | ` sort_take_select ` | 38.1 | 16.2 | 20.4 | 1.26 × |
87+ | ` sum_aggregate ` | 29.9 | 2.2 | 2.1 | 0.95 × |
88+ | ` sum_where ` | 32 .8 | 4.3 | 4.3 | 1.00× |
89+ | ` take_count ` | 3.6 | 0.20 | 0.40 | 2.00 × |
9090| ` take_count_filtered ` | — | 0.20 | 0.20 | 1.00× |
9191| ` take_sum_aggregate ` | — | 0.10 | 0.10 | 1.00× |
92- | ` take_where_count ` | — | 0.10 | 37.5 | 375 .00× |
93- | ` take_while_match ` | 8.5 | 2.7 | 2.6 | 0.96 × |
94- | ` to_array_filter ` | 76.3 | 12 .8 | 13.1 | 1.02 × |
95- | ` zip_count_pred ` | — | 15.6 | — | — |
96- | ` zip_dot_product ` | — | 14.4 | 10.7 | 0.74 × |
97- | ` zip_dot_product_3arg ` | — | 14.7 | — | — |
92+ | ` take_where_count ` | — | 0.10 | 35.4 | 354 .00× |
93+ | ` take_while_match ` | 7.8 | 2.4 | 2.5 | 1.04 × |
94+ | ` to_array_filter ` | 71.0 | 11 .8 | 11.9 | 1.01 × |
95+ | ` zip_count_pred ` | — | 15.1 | — | — |
96+ | ` zip_dot_product ` | — | 12.8 | 10.7 | 0.84 × |
97+ | ` zip_dot_product_3arg ` | — | 12.8 | — | — |
9898
9999## JIT
100100
101101| Benchmark | SQL (m1) | Array (m3f) | Decs (m4) | Decs vs Array |
102102| ---| ---:| ---:| ---:| ---:|
103- | ` aggregate_match ` | 34.1 | 0.40 | 0.70 | 1.75× |
104- | ` all_match ` | 27.3 | 0.30 | 0.20 | 0.67× |
103+ | ` aggregate_match ` | 34.8 | 0.40 | 0.70 | 1.75× |
104+ | ` all_match ` | 27.8 | 0.30 | 0.20 | 0.67× |
105105| ` any_match ` | 0.00 | 0.00 | 0.00 | — |
106- | ` average_aggregate ` | 29.6 | 1.0 | 3.6 | 3.60× |
107- | ` bare_order_where ` | 185.9 | 34.8 | 45.2 | 1.30 × |
106+ | ` average_aggregate ` | 29.9 | 1.0 | 3.6 | 3.60× |
107+ | ` bare_order_where ` | 183.8 | 34.0 | 35.0 | 1.03 × |
108108| ` chained_select_collapse ` | — | 2.1 | 2.1 | 1.00× |
109- | ` chained_where ` | 36.3 | 0.60 | 0.90 | 1.50× |
109+ | ` chained_where ` | 36.4 | 0.60 | 0.90 | 1.50× |
110110| ` contains_match ` | 0.00 | 0.20 | 0.10 | 0.50× |
111- | ` count_aggregate ` | 29.1 | 0.40 | 0.60 | 1.50× |
111+ | ` count_aggregate ` | 29.4 | 0.40 | 0.60 | 1.50× |
112112| ` decs_count_bare_pred ` | — | — | 0.60 | — |
113- | ` distinct_by_count ` | 40.8 | 2.1 | 2.1 | 1.00× |
114- | ` distinct_by_order_take ` | — | 2.7 | 3.3 | 1.22 × |
115- | ` distinct_count ` | 41.1 | 2.1 | 2.1 | 1.00× |
113+ | ` distinct_by_count ` | 41.3 | 2.1 | 2.1 | 1.00× |
114+ | ` distinct_by_order_take ` | — | 2.7 | 3.2 | 1.19 × |
115+ | ` distinct_count ` | 41.2 | 2.1 | 2.1 | 1.00× |
116116| ` distinct_count_pred ` | — | 2.1 | 2.3 | 1.10× |
117117| ` distinct_take ` | 0.00 | 0.00 | 0.00 | — |
118118| ` element_at_match ` | 0.00 | 0.00 | 0.00 | — |
119119| ` first_match ` | 0.00 | 0.00 | 0.00 | — |
120120| ` first_or_default_match ` | 0.00 | 0.00 | 0.00 | — |
121- | ` groupby_average ` | 213.8 | 3.2 | 3.6 | 1.12× |
122- | ` groupby_count ` | 187.1 | 3.0 | 3.1 | 1.03 × |
123- | ` groupby_first ` | — | 2.8 | 4.0 | 1.43 × |
124- | ` groupby_having_count ` | 193.4 | 3.0 | 3.1 | 1.03 × |
125- | ` groupby_having_hidden_sum ` | 238.7 | 3.2 | 3.7 | 1.16 × |
126- | ` groupby_having_post_where ` | 225.4 | 3.1 | 3.5 | 1.13× |
127- | ` groupby_max ` | 228.1 | 3.3 | 3.4 | 1.03 × |
128- | ` groupby_min ` | 219.0 | 3.0 | 3.3 | 1.10 × |
129- | ` groupby_multi_reducer ` | 237.0 | 3.3 | 3.6 | 1.09 × |
130- | ` groupby_select_order ` | 291.3 | 2.8 | 3 .7 | 1.32 × |
131- | ` groupby_select_sum ` | 234.6 | 3.8 | 4.3 | 1.13 × |
132- | ` groupby_sum ` | 200.7 | 2.8 | 3.1 | 1.11 × |
133- | ` groupby_where_count ` | 87.1 | 1.7 | 2.0 | 1.18 × |
134- | ` groupby_where_sum ` | 97.8 | 1.7 | 1.9 | 1.12 × |
135- | ` indexed_lookup ` | 1251 .9 | 38941.4 | 115.5 | 0.00× |
136- | ` join_count ` | 39.3 | 38.7 | 14.6 | 0.38 × |
137- | ` join_groupby_count ` | — | 53.5 | 26.1 | 0.49 × |
138- | ` join_groupby_to_array ` | — | 56.9 | 26 .9 | 0.47 × |
139- | ` join_select ` | — | 43.2 | 24.2 | 0.56 × |
140- | ` join_where_count ` | 39.5 | 42.7 | 24.7 | 0.58 × |
121+ | ` groupby_average ` | 173.1 | 2.6 | 2.9 | 1.12× |
122+ | ` groupby_count ` | 141.3 | 2.4 | 2.5 | 1.04 × |
123+ | ` groupby_first ` | — | 2.2 | 3.1 | 1.41 × |
124+ | ` groupby_having_count ` | 141.8 | 2.4 | 2.5 | 1.04 × |
125+ | ` groupby_having_hidden_sum ` | 179.5 | 2.5 | 2.8 | 1.12 × |
126+ | ` groupby_having_post_where ` | 172.8 | 2.4 | 2.7 | 1.13× |
127+ | ` groupby_max ` | 173.7 | 2.4 | 2.7 | 1.13 × |
128+ | ` groupby_min ` | 173.8 | 2.4 | 2.7 | 1.13 × |
129+ | ` groupby_multi_reducer ` | 190.7 | 2.7 | 3.0 | 1.11 × |
130+ | ` groupby_select_order ` | 171.5 | 2.4 | 2 .7 | 1.13 × |
131+ | ` groupby_select_sum ` | 204.0 | 3.2 | 3.7 | 1.16 × |
132+ | ` groupby_sum ` | 172.2 | 2.4 | 2.7 | 1.13 × |
133+ | ` groupby_where_count ` | 75.7 | 1.5 | 1.8 | 1.20 × |
134+ | ` groupby_where_sum ` | 87.0 | 1.5 | 1.8 | 1.20 × |
135+ | ` indexed_lookup ` | 1242 .9 | 35154.5 | 106.4 | 0.00× |
136+ | ` join_count ` | 38.1 | 34.6 | 12.9 | 0.37 × |
137+ | ` join_groupby_count ` | — | 47.4 | 22.0 | 0.46 × |
138+ | ` join_groupby_to_array ` | — | 54.6 | 21 .9 | 0.40 × |
139+ | ` join_select ` | — | 41.6 | 22.6 | 0.54 × |
140+ | ` join_where_count ` | 39.4 | 41.3 | 23.2 | 0.56 × |
141141| ` last_match ` | 0.00 | 0.50 | 1.4 | 2.80× |
142- | ` long_count_aggregate ` | 29.8 | 0.40 | 0.60 | 1.50× |
143- | ` max_aggregate ` | 31.2 | 0.60 | 0.50 | 0.83× |
144- | ` min_aggregate ` | 36.7 | 0.60 | 0.50 | 0.83× |
142+ | ` long_count_aggregate ` | 29.3 | 0.40 | 0.60 | 1.50× |
143+ | ` max_aggregate ` | 30.6 | 0.60 | 0.50 | 0.83× |
144+ | ` min_aggregate ` | 30.5 | 0.60 | 0.50 | 0.83× |
145145| ` order_distinct_take ` | — | 2.1 | — | — |
146- | ` order_reverse_normalized ` | 38.1 | 0.70 | 1.4 | 2.00 × |
147- | ` order_take_desc ` | 40.4 | 0.70 | 1.3 | 1.86× |
146+ | ` order_reverse_normalized ` | 38.0 | 0.70 | 1.3 | 1.86 × |
147+ | ` order_take_desc ` | 37.8 | 0.70 | 1.3 | 1.86× |
148148| ` reverse_take ` | 0.00 | 0.00 | 1.1 | — |
149- | ` reverse_take_select ` | 0.00 | 8.8 | 10.8 | 1.23 × |
149+ | ` reverse_take_select ` | 0.00 | 8.4 | 10.4 | 1.24 × |
150150| ` select_count ` | 0.10 | 0.00 | 0.00 | — |
151- | ` select_where ` | 107.0 | 4.2 | 5.6 | 1.33× |
151+ | ` select_where ` | 104.4 | 4.2 | 5.6 | 1.33× |
152152| ` select_where_count ` | 32.6 | 0.40 | 0.60 | 1.50× |
153- | ` select_where_order_take ` | 36.6 | 0.70 | 1.4 | 2.00× |
154- | ` select_where_sum ` | 38.6 | 0.50 | 0.60 | 1.20× |
153+ | ` select_where_order_take ` | 36.3 | 0.70 | 1.4 | 2.00× |
154+ | ` select_where_sum ` | 37.1 | 0.50 | 0.60 | 1.20× |
155155| ` single_match ` | 0.00 | 0.40 | 1.1 | 2.75× |
156156| ` skip_take ` | 0.30 | 0.00 | 0.00 | — |
157- | ` skip_while_match ` | 3.5 | 0.40 | 0.40 | 1.00× |
158- | ` sort_first ` | 38.2 | 0.40 | 1.3 | 3.25× |
159- | ` sort_take ` | 38.3 | 0.70 | 1.4 | 2.00 × |
160- | ` sort_take_select ` | 38.5 | 0.70 | 1.4 | 2.00 × |
161- | ` sum_aggregate ` | 30.1 | 0.40 | 0.30 | 0.75× |
162- | ` sum_where ` | 32.4 | 0.40 | 0.60 | 1.50× |
157+ | ` skip_while_match ` | 3.4 | 0.40 | 0.40 | 1.00× |
158+ | ` sort_first ` | 37.6 | 0.40 | 1.3 | 3.25× |
159+ | ` sort_take ` | 38.0 | 0.70 | 1.3 | 1.86 × |
160+ | ` sort_take_select ` | 37.9 | 0.70 | 1.3 | 1.86 × |
161+ | ` sum_aggregate ` | 29.9 | 0.40 | 0.30 | 0.75× |
162+ | ` sum_where ` | 32.9 | 0.40 | 0.60 | 1.50× |
163163| ` take_count ` | 1.8 | 0.10 | 0.10 | 1.00× |
164164| ` take_count_filtered ` | — | 0.00 | 0.00 | — |
165165| ` take_sum_aggregate ` | — | 0.00 | 0.00 | — |
166166| ` take_where_count ` | — | 0.00 | 10.3 | — |
167- | ` take_while_match ` | 8.7 | 0.20 | 0.30 | 1.50× |
168- | ` to_array_filter ` | 48.7 | 3.3 | 3.4 | 1.03× |
167+ | ` take_while_match ` | 7.8 | 0.20 | 0.30 | 1.50× |
168+ | ` to_array_filter ` | 47.8 | 3.3 | 3.4 | 1.03× |
169169| ` zip_count_pred ` | — | 0.70 | — | — |
170170| ` zip_dot_product ` | — | 0.50 | 0.50 | 1.00× |
171171| ` zip_dot_product_3arg ` | — | 0.50 | — | — |
0 commit comments