11# Benchmarks — SQL / Array / Decs comparison
22
3- Generated 2026-05-26 from ` c8b8e6021 ` (PR D1 — group_by pattern-table stubs + reducer data table). Only group_by + join_groupby rows re-run; other rows from ` 2c18845d5 ` (post-Theme-7 ). ** Pending refresh ** for PR D2 (plan_zip + plan_decs_join migrations) — the affected lanes ( ` zip_* ` , ` join_* ` , ` join_groupby_* ` ) are pure pattern-table refactors and expected byte-identical, but a full INTERP+JIT rerun has not yet been done in this PR .
3+ Generated 2026-05-26 from ` 0f88a64b6 ` (PR D3 — full GroupBySourceAdapter melt; closes the linq_fold pattern- table refactor masterplan ). Full INTERP + JIT rerun across all 69 lanes; PRs D1/D2/D3 were pure refactors, so the matrix is expected within run-to-run noise of the prior ` 2c18845d5 ` baseline .
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,151 +26,150 @@ 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 ` | 34.3 | 6.0 | 5.9 | 0.98 × |
30- | ` all_match ` | 27.4 | 3.5 | 3.5 | 1.00× |
29+ | ` aggregate_match ` | 35.1 | 5.9 | 5.9 | 1.00 × |
30+ | ` all_match ` | 28.0 | 3.5 | 3.5 | 1.00× |
3131| ` any_match ` | 0.00 | 0.00 | 0.00 | — |
32- | ` average_aggregate ` | 29.7 | 5.9 | 8.8 | 1.49 × |
33- | ` bare_order_where ` | 279 .1 | 119.0 | 127.4 | 1.07× |
34- | ` chained_select_collapse ` | — | 17.8 | 17.9 | 1.01 × |
35- | ` chained_where ` | 36.1 | 6.7 | 6.7 | 1.00 × |
36- | ` contains_match ` | 0.00 | 2.2 | 1.4 | 0.64 × |
37- | ` count_aggregate ` | 29.0 | 4.1 | 4.1 | 1.00× |
38- | ` decs_count_bare_pred ` | — | — | 4.1 | — |
39- | ` distinct_by_count ` | 40.9 | 15.8 | 16.3 | 1.03 × |
40- | ` distinct_by_order_take ` | — | 21.8 | 23.8 | 1.09 × |
41- | ` distinct_count ` | 41.1 | 16.0 | 16.1 | 1.01 × |
42- | ` distinct_count_pred ` | — | 15.8 | 15.8 | 1.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× |
38+ | ` 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× |
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 ` | 172.0 | 34.0 | 29.9 | 0.88 × |
48- | ` groupby_count ` | 143.7 | 20.4 | 20.4 | 1.00× |
49- | ` groupby_first ` | — | 19.8 | 20.5 | 1.04× |
50- | ` groupby_having_count ` | 141.5 | 20.4 | 20.4 | 1.00× |
51- | ` groupby_having_hidden_sum ` | 175.4 | 24.3 | 24.1 | 0.99× |
52- | ` groupby_having_post_where ` | 170.6 | 19.7 | 19.8 | 1.01 × |
53- | ` groupby_max ` | 175.2 | 25.0 | 25.3 | 1.01 × |
54- | ` groupby_min ` | 174.7 | 25.0 | 25.3 | 1.01 × |
55- | ` groupby_multi_reducer ` | 189.7 | 32.5 | 32.6 | 1.00× |
56- | ` groupby_select_order ` | 170.7 | 19.8 | 19.8 | 1.00 × |
57- | ` groupby_select_sum ` | 200 .6 | 36.5 | 36.7 | 1.01 × |
58- | ` groupby_sum ` | 171 .5 | 19.8 | 19.7 | 0.99× |
59- | ` groupby_where_count ` | 75.4 | 14.6 | 14.9 | 1.02 × |
60- | ` groupby_where_sum ` | 87.0 | 14.2 | 14.7 | 1.04 × |
61- | ` indexed_lookup ` | 1453.6 | 204197.0 | 469.0 | 0.00× |
62- | ` join_count ` | 38.0 | 122.8 | 64.0 | 0.52× |
63- | ` join_groupby_count ` | — | 186.4 | 90.3 | 0.48 × |
64- | ` join_groupby_to_array ` | — | 216.1 | 90.8 | 0.42× |
65- | ` join_select ` | — | 149.0 | 86.3 | 0.58× |
66- | ` join_where_count ` | 39.5 | 149.0 | 81.3 | 0.55 × |
67- | ` last_match ` | 0.00 | 5.9 | 14.0 | 2.37 × |
68- | ` long_count_aggregate ` | 29.1 | 4.1 | 4.1 | 1.00 × |
69- | ` max_aggregate ` | 30.4 | 6.0 | 6.8 | 1.13 × |
70- | ` min_aggregate ` | 30.8 | 6.1 | 6.8 | 1.11 × |
71- | ` order_distinct_take ` | — | 16.1 | — | — |
72- | ` order_reverse_normalized ` | 37.9 | 16.1 | 20.1 | 1.25× |
73- | ` order_take_desc ` | 38.0 | 15.9 | 20.4 | 1.28 × |
74- | ` reverse_take ` | 0.10 | 0.00 | 9.3 | — |
75- | ` reverse_take_select ` | 0.00 | 34.6 | 48.8 | 1.41 × |
76- | ` select_count ` | 0.10 | 0.00 | 2.2 | — |
77- | ` select_where ` | 195 .9 | 11.3 | 19.7 | 1.74 × |
78- | ` select_where_count ` | 32.4 | 5.3 | 7.4 | 1.40 × |
79- | ` select_where_order_take ` | 36.6 | 12.2 | 14.9 | 1.22 × |
80- | ` select_where_sum ` | 37.0 | 7.5 | 7.5 | 1.00 × |
81- | ` single_match ` | 0.00 | 2.9 | 5.6 | 1.93 × |
82- | ` skip_take ` | 0.50 | 0.10 | 0.20 | 2.00× |
83- | ` skip_while_match ` | 3.5 | 5.2 | 5.3 | 1.02 × |
84- | ` sort_first ` | 37.6 | 19.5 | 15.8 | 0.81 × |
85- | ` sort_take ` | 38.0 | 16.4 | 20.4 | 1.24 × |
86- | ` sort_take_select ` | 38.2 | 16.3 | 20.3 | 1.25 × |
87- | ` sum_aggregate ` | 29.7 | 2.2 | 2.1 | 0.95 × |
88- | ` sum_where ` | 32.3 | 4.3 | 4.3 | 1.00× |
89- | ` take_count ` | 3.6 | 0.20 | 0.40 | 2.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 × |
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 | 34.6 | 346 .00× |
93- | ` take_while_match ` | 7.9 | 2.5 | 2.5 | 1.00 × |
94- | ` to_array_filter ` | 70.8 | 11 .8 | 11.9 | 1.01 × |
95- | ` zip_count_pred ` | — | 14.9 | — | — |
96- | ` zip_dot_product ` | — | 12.6 | 10.3 | 0.82 × |
97- | ` zip_dot_product_3arg ` | — | 12.6 | — | — |
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 | — | — |
9898
9999## JIT
100100
101101| Benchmark | SQL (m1) | Array (m3f) | Decs (m4) | Decs vs Array |
102102| ---| ---:| ---:| ---:| ---:|
103- | ` aggregate_match ` | 34.2 | 0.40 | 0.70 | 1.75× |
104- | ` all_match ` | 27.6 | 0.30 | 0.20 | 0.67× |
103+ | ` aggregate_match ` | 34.1 | 0.40 | 0.70 | 1.75× |
104+ | ` all_match ` | 27.3 | 0.30 | 0.20 | 0.67× |
105105| ` any_match ` | 0.00 | 0.00 | 0.00 | — |
106106| ` average_aggregate ` | 29.6 | 1.0 | 3.6 | 3.60× |
107- | ` bare_order_where ` | 186.4 | 34.9 | 34.9 | 1.00 × |
107+ | ` bare_order_where ` | 185.9 | 34.8 | 45.2 | 1.30 × |
108108| ` chained_select_collapse ` | — | 2.1 | 2.1 | 1.00× |
109- | ` chained_where ` | 36.0 | 0.60 | 0.80 | 1.33 × |
109+ | ` chained_where ` | 36.3 | 0.60 | 0.90 | 1.50 × |
110110| ` contains_match ` | 0.00 | 0.20 | 0.10 | 0.50× |
111111| ` count_aggregate ` | 29.1 | 0.40 | 0.60 | 1.50× |
112112| ` decs_count_bare_pred ` | — | — | 0.60 | — |
113113| ` distinct_by_count ` | 40.8 | 2.1 | 2.1 | 1.00× |
114- | ` distinct_by_order_take ` | — | 2.6 | 3.3 | 1.27 × |
115- | ` distinct_count ` | 40.9 | 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× |
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 ` | 170 .8 | 2.6 | 2.9 | 1.12× |
122- | ` groupby_count ` | 142.3 | 2.3 | 2.5 | 1.09 × |
123- | ` groupby_first ` | — | 2.2 | 3.1 | 1.41 × |
124- | ` groupby_having_count ` | 141.5 | 2.4 | 2.5 | 1.04 × |
125- | ` groupby_having_hidden_sum ` | 175 .7 | 2.5 | 2.8 | 1.12 × |
126- | ` groupby_having_post_where ` | 175.9 | 2.4 | 2.7 | 1.13× |
127- | ` groupby_max ` | 173.3 | 2.4 | 2.7 | 1.13 × |
128- | ` groupby_min ` | 173.8 | 2.4 | 2.7 | 1.13 × |
129- | ` groupby_multi_reducer ` | 189.4 | 2.7 | 3.0 | 1.11 × |
130- | ` groupby_select_order ` | 171.2 | 2.4 | 2 .7 | 1.13 × |
131- | ` groupby_select_sum ` | 201 .6 | 3.2 | 3.7 | 1.16 × |
132- | ` groupby_sum ` | 171.8 | 2.4 | 2.7 | 1.13 × |
133- | ` groupby_where_count ` | 75.6 | 1.5 | 1.8 | 1.20 × |
134- | ` groupby_where_sum ` | 86.9 | 1.5 | 1.8 | 1.20 × |
135- | ` indexed_lookup ` | 1238.2 | 35098 .4 | 102.8 | 0.00× |
136- | ` join_count ` | 37.9 | 36.1 | 13.4 | 0.37 × |
137- | ` join_groupby_count ` | — | 48 .5 | 23.2 | 0.48 × |
138- | ` join_groupby_to_array ` | — | 57.4 | 23.1 | 0.40 × |
139- | ` join_select ` | — | 43.3 | 24.6 | 0.57 × |
140- | ` join_where_count ` | 39.0 | 42.7 | 25.4 | 0.59 × |
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 × |
141141| ` last_match ` | 0.00 | 0.50 | 1.4 | 2.80× |
142- | ` long_count_aggregate ` | 29.0 | 0.40 | 0.60 | 1.50× |
143- | ` max_aggregate ` | 30.7 | 0.60 | 0.50 | 0.83× |
144- | ` min_aggregate ` | 30.6 | 0.70 | 0.50 | 0.71 × |
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 × |
145145| ` order_distinct_take ` | — | 2.1 | — | — |
146- | ` order_reverse_normalized ` | 37.9 | 0.70 | 1.4 | 2.00× |
147- | ` order_take_desc ` | 38.0 | 0.70 | 1.4 | 2.00 × |
146+ | ` order_reverse_normalized ` | 38.1 | 0.70 | 1.4 | 2.00× |
147+ | ` order_take_desc ` | 40.4 | 0.70 | 1.3 | 1.86 × |
148148| ` reverse_take ` | 0.00 | 0.00 | 1.1 | — |
149- | ` reverse_take_select ` | 0.00 | 8.7 | 10.6 | 1.22 × |
149+ | ` reverse_take_select ` | 0.00 | 8.8 | 10.8 | 1.23 × |
150150| ` select_count ` | 0.10 | 0.00 | 0.00 | — |
151- | ` select_where ` | 106.2 | 4.2 | 5.8 | 1.38 × |
151+ | ` select_where ` | 107.0 | 4.2 | 5.6 | 1.33 × |
152152| ` select_where_count ` | 32.6 | 0.40 | 0.60 | 1.50× |
153- | ` select_where_order_take ` | 36.2 | 0.70 | 1.4 | 2.00× |
154- | ` select_where_sum ` | 36.9 | 0.50 | 0.60 | 1.20× |
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× |
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.4 | 0.40 | 0.40 | 1.00× |
158- | ` sort_first ` | 37.5 | 0.40 | 1.3 | 3.25× |
159- | ` sort_take ` | 38.0 | 0.70 | 1.4 | 2.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× |
160160| ` sort_take_select ` | 38.5 | 0.70 | 1.4 | 2.00× |
161- | ` sum_aggregate ` | 33.5 | 0.40 | 0.30 | 0.75× |
162- | ` sum_where ` | 32.9 | 0.40 | 0.60 | 1.50× |
161+ | ` sum_aggregate ` | 30.1 | 0.40 | 0.30 | 0.75× |
162+ | ` sum_where ` | 32.4 | 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 | — |
166- | ` take_where_count ` | — | 0.00 | 10.1 | — |
167- | ` take_while_match ` | 8.0 | 0.20 | 0.30 | 1.50× |
168- | ` to_array_filter ` | 48.4 | 3.3 | 3.4 | 1.03× |
166+ | ` 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× |
169169| ` zip_count_pred ` | — | 0.70 | — | — |
170170| ` zip_dot_product ` | — | 0.50 | 0.50 | 1.00× |
171171| ` zip_dot_product_3arg ` | — | 0.50 | — | — |
172172
173-
174173## Notes on missing lanes (the ` — ` cells)
175174
176175The reasons each cell is empty are also recorded as a comment in the
0 commit comments