Skip to content

Conversation

ctsk
Copy link
Contributor

@ctsk ctsk commented Oct 13, 2025

Which issue does this PR close?

What changes are included in this PR?

This PR replaces the locations vector used to reduce the number of allocations / resizes in the accumulator with. a HashMap instead.

Are these changes tested?

Not in particular. Additional unit-tests and broader regression testing would be useful. A microbenchmark verifies that the runtime is no longer quadratic.

Are there any user-facing changes?

No.

@github-actions github-actions bot added common Related to common crate functions Changes to functions implementation labels Oct 13, 2025
@ctsk ctsk force-pushed the fix/min-max-bytes branch from 78333ab to 34e6713 Compare October 14, 2025 09:43
@ctsk ctsk force-pushed the fix/min-max-bytes branch from 34e6713 to 4d6e5e6 Compare October 14, 2025 14:08
Copy link
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be able to post the results of the benchmark as well, for visibility?

Comment on lines +111 to +116
pub mod hash_map {
pub use hashbrown::hash_map::Entry;
}
pub mod hash_set {
pub use hashbrown::hash_set::Entry;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to avoid adding an explicit hashbrown dependency to functions-aggregate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the datafusion_common::HashMap::entry API was not usable without adding an explicit dependency on the hashbrown crate, at which point there is little benefit over using hashbrown::HashMap directly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess it makes sense given we already export hashbrown::HashMap here already 👍

@ctsk
Copy link
Contributor Author

ctsk commented Oct 15, 2025

Would you be able to post the results of the benchmark as well, for visibility?

Of course! Please keep in mind that this is a very specific workload and not broader regression testing

Benchmark results
min_max_bytes/10        time:   [2.1324 ms 2.1351 ms 2.1383 ms]
                        thrpt:  [38.311 Melem/s 38.369 Melem/s 38.417 Melem/s]
                 change:
                        time:   [-2.4648% -1.9429% -1.4676%] (p = 0.00 < 0.05)
                        thrpt:  [+1.4894% +1.9814% +2.5270%]
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high severe
min_max_bytes/20        time:   [4.1660 ms 4.1842 ms 4.2046 ms]
                        thrpt:  [38.967 Melem/s 39.157 Melem/s 39.328 Melem/s]
                 change:
                        time:   [-27.329% -26.771% -26.207%] (p = 0.00 < 0.05)
                        thrpt:  [+35.514% +36.558% +37.607%]
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe
min_max_bytes/50        time:   [11.599 ms 11.635 ms 11.671 ms]
                        thrpt:  [35.097 Melem/s 35.206 Melem/s 35.314 Melem/s]
                 change:
                        time:   [-50.148% -49.739% -49.331%] (p = 0.00 < 0.05)
                        thrpt:  [+97.359% +98.963% +100.59%]
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
min_max_bytes/100       time:   [24.422 ms 24.512 ms 24.611 ms]
                        thrpt:  [33.286 Melem/s 33.420 Melem/s 33.544 Melem/s]
                 change:
                        time:   [-68.470% -68.259% -68.041%] (p = 0.00 < 0.05)
                        thrpt:  [+212.90% +215.05% +217.16%]
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  6 (6.00%) high mild
  2 (2.00%) high severe
min_max_bytes/150       time:   [37.990 ms 38.069 ms 38.150 ms]
                        thrpt:  [32.210 Melem/s 32.278 Melem/s 32.346 Melem/s]
                 change:
                        time:   [-74.820% -74.358% -73.932%] (p = 0.00 < 0.05)
                        thrpt:  [+283.61% +289.98% +297.14%]
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
min_max_bytes/200       time:   [49.525 ms 49.595 ms 49.664 ms]
                        thrpt:  [32.990 Melem/s 33.036 Melem/s 33.082 Melem/s]
                 change:
                        time:   [-85.623% -85.596% -85.569%] (p = 0.00 < 0.05)
                        thrpt:  [+592.93% +594.25% +595.56%]
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low mild
Benchmarking min_max_bytes/300: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.7s, or reduce sample count to 60.
min_max_bytes/300       time:   [76.764 ms 76.883 ms 77.005 ms]
                        thrpt:  [31.915 Melem/s 31.965 Melem/s 32.015 Melem/s]
                 change:
                        time:   [-90.252% -90.233% -90.214%] (p = 0.00 < 0.05)
                        thrpt:  [+921.91% +923.83% +925.85%]
                        Performance has improved.
Benchmarking min_max_bytes/400: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 10.0s, or reduce sample count to 40.
min_max_bytes/400       time:   [100.19 ms 100.39 ms 100.62 ms]
                        thrpt:  [32.567 Melem/s 32.640 Melem/s 32.707 Melem/s]
                 change:
                        time:   [-92.854% -92.835% -92.815%] (p = 0.00 < 0.05)
                        thrpt:  [+1291.9% +1295.6% +1299.3%]
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  4 (4.00%) high mild
  1 (1.00%) high severe
Benchmarking min_max_bytes/500: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 12.3s, or reduce sample count to 40.
min_max_bytes/500       time:   [123.16 ms 123.36 ms 123.57 ms]
                        thrpt:  [33.148 Melem/s 33.204 Melem/s 33.259 Melem/s]
                 change:
                        time:   [-94.422% -94.398% -94.376%] (p = 0.00 < 0.05)
                        thrpt:  [+1678.1% +1685.1% +1692.7%]
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  7 (7.00%) high mild

Copy link
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me; we're just allocating for only the groups we need instead of for all groups (even if not being used in the current update_batch) if I understand correctly

@alamb
Copy link
Contributor

alamb commented Oct 17, 2025

🤖 ./gh_compare_branch.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing fix/min-max-bytes (4d6e5e6) to 4e69241 diff using: tpch_mem clickbench_partitioned clickbench_extended
Results will be posted here when complete

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ctsk and @Jefffrey -- I have kicked off some benchmarks for this PR with my script just to double check but I think it looks good and makes sense to me

@alamb
Copy link
Contributor

alamb commented Oct 17, 2025

🤖: Benchmark completed

Details

Comparing HEAD and fix_min-max-bytes
--------------------
Benchmark clickbench_extended.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ fix_min-max-bytes ┃    Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ QQuery 0     │  2725.82 ms │        2596.66 ms │ no change │
│ QQuery 1     │  1284.60 ms │        1258.18 ms │ no change │
│ QQuery 2     │  2411.11 ms │        2438.55 ms │ no change │
│ QQuery 3     │  1183.02 ms │        1164.22 ms │ no change │
│ QQuery 4     │  2247.59 ms │        2249.80 ms │ no change │
│ QQuery 5     │ 26863.38 ms │       27412.80 ms │ no change │
│ QQuery 6     │  4143.67 ms │        4231.50 ms │ no change │
│ QQuery 7     │  3808.48 ms │        3713.32 ms │ no change │
└──────────────┴─────────────┴───────────────────┴───────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 44667.67ms │
│ Total Time (fix_min-max-bytes)   │ 45065.03ms │
│ Average Time (HEAD)              │  5583.46ms │
│ Average Time (fix_min-max-bytes) │  5633.13ms │
│ Queries Faster                   │          0 │
│ Queries Slower                   │          0 │
│ Queries with No Change           │          8 │
│ Queries with Failure             │          0 │
└──────────────────────────────────┴────────────┘
--------------------
Benchmark clickbench_partitioned.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ fix_min-max-bytes ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     2.19 ms │           2.12 ms │     no change │
│ QQuery 1     │    50.71 ms │          51.50 ms │     no change │
│ QQuery 2     │   137.89 ms │         140.39 ms │     no change │
│ QQuery 3     │   162.52 ms │         159.17 ms │     no change │
│ QQuery 4     │  1010.60 ms │        1040.75 ms │     no change │
│ QQuery 5     │  1464.74 ms │        1483.20 ms │     no change │
│ QQuery 6     │     2.25 ms │           2.15 ms │     no change │
│ QQuery 7     │    53.10 ms │          55.69 ms │     no change │
│ QQuery 8     │  1384.96 ms │        1420.27 ms │     no change │
│ QQuery 9     │  1765.43 ms │        1798.59 ms │     no change │
│ QQuery 10    │   390.63 ms │         381.01 ms │     no change │
│ QQuery 11    │   444.81 ms │         443.51 ms │     no change │
│ QQuery 12    │  1344.44 ms │        1384.21 ms │     no change │
│ QQuery 13    │  2124.99 ms │        2137.75 ms │     no change │
│ QQuery 14    │  1236.69 ms │        1280.03 ms │     no change │
│ QQuery 15    │  1143.09 ms │        1229.18 ms │  1.08x slower │
│ QQuery 16    │  2589.99 ms │        2658.21 ms │     no change │
│ QQuery 17    │  2546.58 ms │        2651.78 ms │     no change │
│ QQuery 18    │  4785.09 ms │        4924.80 ms │     no change │
│ QQuery 19    │   123.89 ms │         124.91 ms │     no change │
│ QQuery 20    │  1979.67 ms │        2040.71 ms │     no change │
│ QQuery 21    │  2324.03 ms │        2343.19 ms │     no change │
│ QQuery 22    │  3949.61 ms │        4048.43 ms │     no change │
│ QQuery 23    │ 12860.76 ms │       12980.36 ms │     no change │
│ QQuery 24    │   210.50 ms │         222.08 ms │  1.06x slower │
│ QQuery 25    │   507.71 ms │         508.51 ms │     no change │
│ QQuery 26    │   212.78 ms │         222.90 ms │     no change │
│ QQuery 27    │  2812.68 ms │        2894.52 ms │     no change │
│ QQuery 28    │ 24667.20 ms │       22645.39 ms │ +1.09x faster │
│ QQuery 29    │   970.63 ms │         953.07 ms │     no change │
│ QQuery 30    │  1315.34 ms │        1317.67 ms │     no change │
│ QQuery 31    │  1313.17 ms │        1336.53 ms │     no change │
│ QQuery 32    │  4439.28 ms │        4637.41 ms │     no change │
│ QQuery 33    │  5637.14 ms │        5680.20 ms │     no change │
│ QQuery 34    │  5861.45 ms │        5920.27 ms │     no change │
│ QQuery 35    │  1989.80 ms │        2015.76 ms │     no change │
│ QQuery 36    │   120.23 ms │         120.96 ms │     no change │
│ QQuery 37    │    53.30 ms │          53.19 ms │     no change │
│ QQuery 38    │   119.97 ms │         122.63 ms │     no change │
│ QQuery 39    │   194.82 ms │         198.30 ms │     no change │
│ QQuery 40    │    42.83 ms │          44.18 ms │     no change │
│ QQuery 41    │    40.44 ms │          41.02 ms │     no change │
│ QQuery 42    │    31.99 ms │          32.30 ms │     no change │
└──────────────┴─────────────┴───────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 94419.91ms │
│ Total Time (fix_min-max-bytes)   │ 93748.81ms │
│ Average Time (HEAD)              │  2195.81ms │
│ Average Time (fix_min-max-bytes) │  2180.20ms │
│ Queries Faster                   │          1 │
│ Queries Slower                   │          2 │
│ Queries with No Change           │         40 │
│ Queries with Failure             │          0 │
└──────────────────────────────────┴────────────┘
--------------------
Benchmark tpch_mem_sf1.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃      HEAD ┃ fix_min-max-bytes ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1     │ 166.43 ms │         164.65 ms │     no change │
│ QQuery 2     │  26.67 ms │          26.47 ms │     no change │
│ QQuery 3     │  40.24 ms │          34.47 ms │ +1.17x faster │
│ QQuery 4     │  28.25 ms │          27.53 ms │     no change │
│ QQuery 5     │  76.54 ms │          74.43 ms │     no change │
│ QQuery 6     │  19.23 ms │          19.03 ms │     no change │
│ QQuery 7     │ 211.83 ms │         203.56 ms │     no change │
│ QQuery 8     │  30.67 ms │          33.48 ms │  1.09x slower │
│ QQuery 9     │ 101.97 ms │         102.49 ms │     no change │
│ QQuery 10    │  58.60 ms │          57.93 ms │     no change │
│ QQuery 11    │  16.41 ms │          16.00 ms │     no change │
│ QQuery 12    │  50.75 ms │          50.05 ms │     no change │
│ QQuery 13    │  46.93 ms │          46.60 ms │     no change │
│ QQuery 14    │  13.59 ms │          13.77 ms │     no change │
│ QQuery 15    │  23.96 ms │          23.52 ms │     no change │
│ QQuery 16    │  24.36 ms │          24.05 ms │     no change │
│ QQuery 17    │ 145.32 ms │         144.74 ms │     no change │
│ QQuery 18    │ 315.00 ms │         313.01 ms │     no change │
│ QQuery 19    │  36.05 ms │          37.15 ms │     no change │
│ QQuery 20    │  47.72 ms │          48.72 ms │     no change │
│ QQuery 21    │ 321.98 ms │         327.01 ms │     no change │
│ QQuery 22    │  19.93 ms │          19.95 ms │     no change │
└──────────────┴───────────┴───────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 1822.42ms │
│ Total Time (fix_min-max-bytes)   │ 1808.60ms │
│ Average Time (HEAD)              │   82.84ms │
│ Average Time (fix_min-max-bytes) │   82.21ms │
│ Queries Faster                   │         1 │
│ Queries Slower                   │         1 │
│ Queries with No Change           │        20 │
│ Queries with Failure             │         0 │
└──────────────────────────────────┴───────────┘

@alamb
Copy link
Contributor

alamb commented Oct 17, 2025

🤖 ./gh_compare_branch_bench.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing fix/min-max-bytes (4d6e5e6) to 4e69241 diff
BENCH_NAME=min_max_bytes
BENCH_COMMAND=cargo bench --bench min_max_bytes
BENCH_FILTER=
BENCH_BRANCH_NAME=fix_min-max-bytes
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 17, 2025

🤖 ./gh_compare_branch.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing fix/min-max-bytes (4d6e5e6) to 4e69241 diff using: tpch_mem clickbench_partitioned clickbench_extended
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 17, 2025

🤖: Benchmark completed

Details

Comparing HEAD and fix_min-max-bytes
--------------------
Benchmark clickbench_extended.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ fix_min-max-bytes ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │  2571.49 ms │        2619.20 ms │     no change │
│ QQuery 1     │  1304.01 ms │        1229.24 ms │ +1.06x faster │
│ QQuery 2     │  2397.89 ms │        2432.89 ms │     no change │
│ QQuery 3     │  1169.88 ms │        1168.50 ms │     no change │
│ QQuery 4     │  2213.44 ms │        2177.17 ms │     no change │
│ QQuery 5     │ 27423.96 ms │       27079.04 ms │     no change │
│ QQuery 6     │  4185.27 ms │        4224.94 ms │     no change │
│ QQuery 7     │  3514.41 ms │        3437.32 ms │     no change │
└──────────────┴─────────────┴───────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 44780.36ms │
│ Total Time (fix_min-max-bytes)   │ 44368.28ms │
│ Average Time (HEAD)              │  5597.54ms │
│ Average Time (fix_min-max-bytes) │  5546.04ms │
│ Queries Faster                   │          1 │
│ Queries Slower                   │          0 │
│ Queries with No Change           │          7 │
│ Queries with Failure             │          0 │
└──────────────────────────────────┴────────────┘
--------------------
Benchmark clickbench_partitioned.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ fix_min-max-bytes ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     2.12 ms │           2.15 ms │     no change │
│ QQuery 1     │    51.43 ms │          49.47 ms │     no change │
│ QQuery 2     │   139.57 ms │         142.50 ms │     no change │
│ QQuery 3     │   162.77 ms │         163.89 ms │     no change │
│ QQuery 4     │  1030.39 ms │        1022.62 ms │     no change │
│ QQuery 5     │  1503.03 ms │        1464.05 ms │     no change │
│ QQuery 6     │     2.20 ms │           2.12 ms │     no change │
│ QQuery 7     │    54.98 ms │          53.03 ms │     no change │
│ QQuery 8     │  1417.31 ms │        1418.31 ms │     no change │
│ QQuery 9     │  1861.50 ms │        1793.09 ms │     no change │
│ QQuery 10    │   390.07 ms │         386.23 ms │     no change │
│ QQuery 11    │   440.73 ms │         433.05 ms │     no change │
│ QQuery 12    │  1365.97 ms │        1359.96 ms │     no change │
│ QQuery 13    │  2111.76 ms │        2139.07 ms │     no change │
│ QQuery 14    │  1254.26 ms │        1259.45 ms │     no change │
│ QQuery 15    │  1143.84 ms │        1180.83 ms │     no change │
│ QQuery 16    │  2611.87 ms │        2592.91 ms │     no change │
│ QQuery 17    │  2572.62 ms │        2595.88 ms │     no change │
│ QQuery 18    │  5000.39 ms │        4884.82 ms │     no change │
│ QQuery 19    │   126.84 ms │         125.70 ms │     no change │
│ QQuery 20    │  2025.31 ms │        2041.21 ms │     no change │
│ QQuery 21    │  2338.21 ms │        2353.29 ms │     no change │
│ QQuery 22    │  3997.56 ms │        4007.61 ms │     no change │
│ QQuery 23    │ 17512.60 ms │       12934.58 ms │ +1.35x faster │
│ QQuery 24    │   211.78 ms │         224.50 ms │  1.06x slower │
│ QQuery 25    │   518.59 ms │         529.37 ms │     no change │
│ QQuery 26    │   226.31 ms │         232.78 ms │     no change │
│ QQuery 27    │  2945.83 ms │        2879.71 ms │     no change │
│ QQuery 28    │ 24773.79 ms │       22655.20 ms │ +1.09x faster │
│ QQuery 29    │   956.95 ms │         955.43 ms │     no change │
│ QQuery 30    │  1326.60 ms │        1326.43 ms │     no change │
│ QQuery 31    │  1355.62 ms │        1316.46 ms │     no change │
│ QQuery 32    │  4485.35 ms │        4341.80 ms │     no change │
│ QQuery 33    │  5586.39 ms │        5667.37 ms │     no change │
│ QQuery 34    │  5943.73 ms │        5866.96 ms │     no change │
│ QQuery 35    │  2004.75 ms │        1965.19 ms │     no change │
│ QQuery 36    │   126.61 ms │         120.23 ms │ +1.05x faster │
│ QQuery 37    │    53.75 ms │          53.17 ms │     no change │
│ QQuery 38    │   120.19 ms │         122.10 ms │     no change │
│ QQuery 39    │   199.07 ms │         198.42 ms │     no change │
│ QQuery 40    │    41.42 ms │          44.22 ms │  1.07x slower │
│ QQuery 41    │    38.76 ms │          40.82 ms │  1.05x slower │
│ QQuery 42    │    32.49 ms │          32.21 ms │     no change │
└──────────────┴─────────────┴───────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ Benchmark Summary                ┃             ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 100065.31ms │
│ Total Time (fix_min-max-bytes)   │  92978.19ms │
│ Average Time (HEAD)              │   2327.10ms │
│ Average Time (fix_min-max-bytes) │   2162.28ms │
│ Queries Faster                   │           3 │
│ Queries Slower                   │           3 │
│ Queries with No Change           │          37 │
│ Queries with Failure             │           0 │
└──────────────────────────────────┴─────────────┘
--------------------
Benchmark tpch_mem_sf1.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃      HEAD ┃ fix_min-max-bytes ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1     │ 167.33 ms │         163.01 ms │     no change │
│ QQuery 2     │  26.60 ms │          24.67 ms │ +1.08x faster │
│ QQuery 3     │  39.57 ms │          36.61 ms │ +1.08x faster │
│ QQuery 4     │  27.49 ms │          27.75 ms │     no change │
│ QQuery 5     │  75.66 ms │          77.05 ms │     no change │
│ QQuery 6     │  19.15 ms │          19.06 ms │     no change │
│ QQuery 7     │ 204.70 ms │         204.64 ms │     no change │
│ QQuery 8     │  33.28 ms │          33.55 ms │     no change │
│ QQuery 9     │ 101.31 ms │         101.20 ms │     no change │
│ QQuery 10    │  58.94 ms │          58.22 ms │     no change │
│ QQuery 11    │  16.85 ms │          17.36 ms │     no change │
│ QQuery 12    │  49.87 ms │          49.85 ms │     no change │
│ QQuery 13    │  46.17 ms │          45.53 ms │     no change │
│ QQuery 14    │  13.82 ms │          13.41 ms │     no change │
│ QQuery 15    │  24.02 ms │          24.01 ms │     no change │
│ QQuery 16    │  24.17 ms │          24.35 ms │     no change │
│ QQuery 17    │ 141.53 ms │         143.77 ms │     no change │
│ QQuery 18    │ 318.47 ms │         321.08 ms │     no change │
│ QQuery 19    │  36.26 ms │          36.54 ms │     no change │
│ QQuery 20    │  47.33 ms │          47.20 ms │     no change │
│ QQuery 21    │ 332.33 ms │         328.01 ms │     no change │
│ QQuery 22    │  19.69 ms │          19.79 ms │     no change │
└──────────────┴───────────┴───────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 1824.54ms │
│ Total Time (fix_min-max-bytes)   │ 1816.67ms │
│ Average Time (HEAD)              │   82.93ms │
│ Average Time (fix_min-max-bytes) │   82.58ms │
│ Queries Faster                   │         2 │
│ Queries Slower                   │         0 │
│ Queries with No Change           │        20 │
│ Queries with Failure             │         0 │
└──────────────────────────────────┴───────────┘

@alamb
Copy link
Contributor

alamb commented Oct 17, 2025

🤖 ./gh_compare_branch_bench.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing fix/min-max-bytes (4d6e5e6) to 4e69241 diff
BENCH_NAME=min_max_bytes
BENCH_COMMAND=cargo bench --bench min_max_bytes
BENCH_FILTER=
BENCH_BRANCH_NAME=fix_min-max-bytes
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖 ./gh_compare_branch.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing fix/min-max-bytes (5649ff2) to 93f136c diff using: tpch_mem clickbench_partitioned clickbench_extended
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖: Benchmark completed

Details

Comparing HEAD and fix_min-max-bytes
--------------------
Benchmark clickbench_extended.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ fix_min-max-bytes ┃    Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ QQuery 0     │  2745.64 ms │        2693.36 ms │ no change │
│ QQuery 1     │  1411.68 ms │        1384.99 ms │ no change │
│ QQuery 2     │  2552.92 ms │        2549.51 ms │ no change │
│ QQuery 3     │  1192.11 ms │        1185.42 ms │ no change │
│ QQuery 4     │  2254.85 ms │        2260.57 ms │ no change │
│ QQuery 5     │ 27053.06 ms │       27555.89 ms │ no change │
│ QQuery 6     │  4242.60 ms │        4112.26 ms │ no change │
│ QQuery 7     │  3811.63 ms │        3627.21 ms │ no change │
└──────────────┴─────────────┴───────────────────┴───────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 45264.49ms │
│ Total Time (fix_min-max-bytes)   │ 45369.22ms │
│ Average Time (HEAD)              │  5658.06ms │
│ Average Time (fix_min-max-bytes) │  5671.15ms │
│ Queries Faster                   │          0 │
│ Queries Slower                   │          0 │
│ Queries with No Change           │          8 │
│ Queries with Failure             │          0 │
└──────────────────────────────────┴────────────┘
--------------------
Benchmark clickbench_partitioned.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃        HEAD ┃ fix_min-max-bytes ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0     │     2.07 ms │           2.25 ms │  1.09x slower │
│ QQuery 1     │    50.35 ms │          50.11 ms │     no change │
│ QQuery 2     │   136.27 ms │         136.39 ms │     no change │
│ QQuery 3     │   163.52 ms │         164.03 ms │     no change │
│ QQuery 4     │  1022.42 ms │        1200.31 ms │  1.17x slower │
│ QQuery 5     │  1481.52 ms │        1628.89 ms │  1.10x slower │
│ QQuery 6     │     2.10 ms │           2.17 ms │     no change │
│ QQuery 7     │    54.68 ms │          57.42 ms │  1.05x slower │
│ QQuery 8     │  1430.76 ms │        1563.06 ms │  1.09x slower │
│ QQuery 9     │  1760.78 ms │        1864.62 ms │  1.06x slower │
│ QQuery 10    │   384.94 ms │         387.12 ms │     no change │
│ QQuery 11    │   440.39 ms │         437.92 ms │     no change │
│ QQuery 12    │  1355.31 ms │        1497.28 ms │  1.10x slower │
│ QQuery 13    │  2101.21 ms │        2210.13 ms │  1.05x slower │
│ QQuery 14    │  1265.19 ms │        1337.43 ms │  1.06x slower │
│ QQuery 15    │  1202.13 ms │        1335.21 ms │  1.11x slower │
│ QQuery 16    │  2645.25 ms │        2716.24 ms │     no change │
│ QQuery 17    │  2648.87 ms │        2759.55 ms │     no change │
│ QQuery 18    │  5478.05 ms │        5121.72 ms │ +1.07x faster │
│ QQuery 19    │   126.59 ms │         129.86 ms │     no change │
│ QQuery 20    │  2077.08 ms │        1959.01 ms │ +1.06x faster │
│ QQuery 21    │  2376.23 ms │        2274.98 ms │     no change │
│ QQuery 22    │  4132.80 ms │        3886.03 ms │ +1.06x faster │
│ QQuery 23    │ 13086.99 ms │       12688.71 ms │     no change │
│ QQuery 24    │   219.50 ms │         212.25 ms │     no change │
│ QQuery 25    │   529.26 ms │         496.19 ms │ +1.07x faster │
│ QQuery 26    │   232.43 ms │         217.03 ms │ +1.07x faster │
│ QQuery 27    │  2985.10 ms │        2814.83 ms │ +1.06x faster │
│ QQuery 28    │ 23232.30 ms │       23817.95 ms │     no change │
│ QQuery 29    │   984.68 ms │         991.40 ms │     no change │
│ QQuery 30    │  1326.72 ms │        1351.09 ms │     no change │
│ QQuery 31    │  1330.18 ms │        1325.49 ms │     no change │
│ QQuery 32    │  4528.15 ms │        4758.20 ms │  1.05x slower │
│ QQuery 33    │  5899.85 ms │        5810.07 ms │     no change │
│ QQuery 34    │  5862.75 ms │        5833.11 ms │     no change │
│ QQuery 35    │  2035.94 ms │        2102.99 ms │     no change │
│ QQuery 36    │   122.17 ms │         120.62 ms │     no change │
│ QQuery 37    │    52.29 ms │          53.35 ms │     no change │
│ QQuery 38    │   120.99 ms │         121.65 ms │     no change │
│ QQuery 39    │   197.81 ms │         204.39 ms │     no change │
│ QQuery 40    │    43.46 ms │          45.35 ms │     no change │
│ QQuery 41    │    39.44 ms │          41.55 ms │  1.05x slower │
│ QQuery 42    │    32.22 ms │          32.10 ms │     no change │
└──────────────┴─────────────┴───────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 95200.74ms │
│ Total Time (fix_min-max-bytes)   │ 95760.05ms │
│ Average Time (HEAD)              │  2213.97ms │
│ Average Time (fix_min-max-bytes) │  2226.98ms │
│ Queries Faster                   │          6 │
│ Queries Slower                   │         12 │
│ Queries with No Change           │         25 │
│ Queries with Failure             │          0 │
└──────────────────────────────────┴────────────┘
--------------------
Benchmark tpch_mem_sf1.json
--------------------
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query        ┃      HEAD ┃ fix_min-max-bytes ┃        Change ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1     │ 168.74 ms │         168.76 ms │     no change │
│ QQuery 2     │  26.60 ms │          25.37 ms │     no change │
│ QQuery 3     │  40.87 ms │          40.19 ms │     no change │
│ QQuery 4     │  27.56 ms │          27.92 ms │     no change │
│ QQuery 5     │  74.48 ms │          76.54 ms │     no change │
│ QQuery 6     │  19.35 ms │          19.43 ms │     no change │
│ QQuery 7     │ 204.74 ms │         209.29 ms │     no change │
│ QQuery 8     │  34.08 ms │          30.49 ms │ +1.12x faster │
│ QQuery 9     │  93.94 ms │         103.12 ms │  1.10x slower │
│ QQuery 10    │  57.04 ms │          57.96 ms │     no change │
│ QQuery 11    │  16.81 ms │          16.79 ms │     no change │
│ QQuery 12    │  50.50 ms │          51.21 ms │     no change │
│ QQuery 13    │  44.58 ms │          45.25 ms │     no change │
│ QQuery 14    │  13.23 ms │          13.00 ms │     no change │
│ QQuery 15    │  23.97 ms │          24.13 ms │     no change │
│ QQuery 16    │  24.36 ms │          24.53 ms │     no change │
│ QQuery 17    │ 145.49 ms │         148.38 ms │     no change │
│ QQuery 18    │ 315.91 ms │         324.01 ms │     no change │
│ QQuery 19    │  36.27 ms │          36.03 ms │     no change │
│ QQuery 20    │  47.32 ms │          47.59 ms │     no change │
│ QQuery 21    │ 323.74 ms │         306.96 ms │ +1.05x faster │
│ QQuery 22    │  20.45 ms │          20.56 ms │     no change │
└──────────────┴───────────┴───────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                │ 1810.03ms │
│ Total Time (fix_min-max-bytes)   │ 1817.52ms │
│ Average Time (HEAD)              │   82.27ms │
│ Average Time (fix_min-max-bytes) │   82.61ms │
│ Queries Faster                   │         2 │
│ Queries Slower                   │         1 │
│ Queries with No Change           │        19 │
│ Queries with Failure             │         0 │
└──────────────────────────────────┴───────────┘

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖 ./gh_compare_branch_bench.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing fix/min-max-bytes (5649ff2) to 93f136c diff
BENCH_NAME=min_max_bytes
BENCH_COMMAND=cargo bench --bench min_max_bytes
BENCH_FILTER=
BENCH_BRANCH_NAME=fix_min-max-bytes
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖: Benchmark completed

Details

group                fix_min-max-bytes                      main
-----                -----------------                      ----
min_max_bytes/10     1.00      5.8±0.05ms 13.5 MElem/sec    1.19      6.8±0.06ms 11.4 MElem/sec
min_max_bytes/100    1.00    110.5±1.36ms  7.1 MElem/sec    1.24    136.7±1.29ms  5.7 MElem/sec
min_max_bytes/150    1.00    182.2±1.07ms  6.4 MElem/sec    1.62    294.8±3.62ms  4.0 MElem/sec
min_max_bytes/20     1.04     16.8±0.34ms  9.3 MElem/sec    1.00     16.2±0.33ms  9.7 MElem/sec
min_max_bytes/200    1.00    232.2±1.60ms  6.7 MElem/sec    2.14    497.7±6.57ms  3.1 MElem/sec
min_max_bytes/300    1.00    339.2±2.09ms  6.9 MElem/sec    5.08  1721.4±26.64ms 1394.2 KElem/sec
min_max_bytes/400    1.00    447.2±2.79ms  7.0 MElem/sec    9.72       4.3±0.04s 736.1 KElem/sec
min_max_bytes/50     1.00     48.3±1.65ms  8.1 MElem/sec    1.09     52.6±0.57ms  7.4 MElem/sec
min_max_bytes/500    1.00    561.6±2.89ms  7.0 MElem/sec    13.84      7.8±0.06s 514.6 KElem/sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quadratic runtime in MinMaxBytesAccumulator

3 participants