Skip to content

perf: outline column desc for min max - #10389

Draft
MassivePizza wants to merge 2 commits into
apache:mainfrom
massive-com:outline-column-desc-for-min-max
Draft

perf: outline column desc for min max#10389
MassivePizza wants to merge 2 commits into
apache:mainfrom
massive-com:outline-column-desc-for-min-max

Conversation

@MassivePizza

@MassivePizza MassivePizza commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Related to

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions Bot added the parquet Changes to the parquet crate label Jul 20, 2026
alamb pushed a commit that referenced this pull request Jul 25, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->
N/A

# Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
Converting decimals and FixedLenByteArrays to individual allocs requires
a lot of alloc+drop time and memory overhead.

# What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
Allocate one big buffer, and cut it up into slices of `bytes::Bytes`.
This amortizes the alloc upfront, and effectively eliminates the drop
overhead by turning a dealloc to an Arc decrement per slice.

This still has moderate memory overhead. `Bytes` is 32 bytes, while the
slices usually expose less than 16 bytes at a time e.g. UUIDs or
decimal128, but a lot more effort would be required to implement a
(perhaps borrowed?) alternative that behaves like `FixedLenByteArray`.

There are a few other ideas worth exploring, primarily custom
`ColumnValueEncoder`s that converts on the fly to avoid the temporary
allocs all together.

~~There is also a small outlining+inlining in `compare_greater` to help
out in the `get_min_max` loop.~~ Extracted to
#10389.

# Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->
Should be covered by existing tests. There are also new benches included
(extracted to #10388):

<details>
<summary>decimal bench</summary>

```
Benchmarking decimal/default: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.4s, or reduce sample count to 90.
decimal/default         time:   [53.676 ms 53.979 ms 54.306 ms]
                        thrpt:  [1.0790 GiB/s 1.0855 GiB/s 1.0916 GiB/s]
                 change:
                        time:   [−44.611% −44.247% −43.885%] (p = 0.00 < 0.05)
                        thrpt:  [+78.204% +79.362% +80.542%]
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  4 (4.00%) high mild
  1 (1.00%) high severe
Benchmarking decimal/bloom_filter: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.8s, or reduce sample count to 70.
decimal/bloom_filter    time:   [66.597 ms 66.838 ms 67.095 ms]
                        thrpt:  [894.26 MiB/s 897.70 MiB/s 900.94 MiB/s]
                 change:
                        time:   [−40.229% −39.907% −39.555%] (p = 0.00 < 0.05)
                        thrpt:  [+65.440% +66.408% +67.306%]
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  8 (8.00%) high mild
  2 (2.00%) high severe
Benchmarking decimal/parquet_2: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 10.8s, or reduce sample count to 40.
decimal/parquet_2       time:   [105.82 ms 106.23 ms 106.66 ms]
                        thrpt:  [562.52 MiB/s 564.84 MiB/s 567.02 MiB/s]
                 change:
                        time:   [−48.804% −48.523% −48.229%] (p = 0.00 < 0.05)
                        thrpt:  [+93.160% +94.263% +95.329%]
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe
Benchmarking decimal/zstd: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.4s, or reduce sample count to 70.
decimal/zstd            time:   [61.806 ms 62.013 ms 62.282 ms]
                        thrpt:  [963.36 MiB/s 967.55 MiB/s 970.78 MiB/s]
                 change:
                        time:   [−60.257% −59.907% −59.556%] (p = 0.00 < 0.05)
                        thrpt:  [+147.25% +149.42% +151.62%]
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) low severe
  2 (2.00%) low mild
  5 (5.00%) high mild
  3 (3.00%) high severe
Benchmarking decimal/zstd_parquet_2: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 11.9s, or reduce sample count to 40.
decimal/zstd_parquet_2  time:   [119.51 ms 119.87 ms 120.29 ms]
                        thrpt:  [498.82 MiB/s 500.54 MiB/s 502.07 MiB/s]
                 change:
                        time:   [−55.716% −55.352% −54.992%] (p = 0.00 < 0.05)
                        thrpt:  [+122.18% +123.98% +125.82%]
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  2 (2.00%) low mild
  2 (2.00%) high mild
  7 (7.00%) high severe
Benchmarking decimal/cdc: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.8s, or reduce sample count to 60.
decimal/cdc             time:   [77.810 ms 78.092 ms 78.389 ms]
                        thrpt:  [765.42 MiB/s 768.33 MiB/s 771.11 MiB/s]
                 change:
                        time:   [−35.689% −35.360% −35.011%] (p = 0.00 < 0.05)
                        thrpt:  [+53.873% +54.703% +55.494%]
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  10 (10.00%) high mild
```
</details>

<details>
<summary>fsb bench</summary>

```
fsb/default             time:   [5.4152 ms 5.4276 ms 5.4407 ms]
                        thrpt:  [2.8943 GiB/s 2.9013 GiB/s 2.9079 GiB/s]
                 change:
                        time:   [−27.824% −27.512% −27.215%] (p = 0.00 < 0.05)
                        thrpt:  [+37.391% +37.953% +38.550%]
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low mild
  5 (5.00%) high mild
  1 (1.00%) high severe
fsb/bloom_filter        time:   [5.8681 ms 5.8908 ms 5.9154 ms]
                        thrpt:  [2.6621 GiB/s 2.6732 GiB/s 2.6835 GiB/s]
                 change:
                        time:   [−25.701% −25.298% −24.896%] (p = 0.00 < 0.05)
                        thrpt:  [+33.148% +33.866% +34.592%]
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
fsb/parquet_2           time:   [8.6936 ms 8.7692 ms 8.8503 ms]
                        thrpt:  [1.7793 GiB/s 1.7957 GiB/s 1.8113 GiB/s]
                 change:
                        time:   [−31.621% −31.005% −30.286%] (p = 0.00 < 0.05)
                        thrpt:  [+43.444% +44.939% +46.243%]
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  9 (9.00%) high mild
  1 (1.00%) high severe
fsb/zstd                time:   [7.1760 ms 7.2043 ms 7.2360 ms]
                        thrpt:  [2.1762 GiB/s 2.1858 GiB/s 2.1944 GiB/s]
                 change:
                        time:   [−21.480% −21.068% −20.631%] (p = 0.00 < 0.05)
                        thrpt:  [+25.994% +26.692% +27.356%]
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
fsb/zstd_parquet_2      time:   [9.2977 ms 9.4085 ms 9.5422 ms]
                        thrpt:  [1.6503 GiB/s 1.6737 GiB/s 1.6937 GiB/s]
                 change:
                        time:   [−30.266% −29.333% −28.383%] (p = 0.00 < 0.05)
                        thrpt:  [+39.632% +41.508% +43.401%]
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe
fsb/cdc                 time:   [7.9524 ms 7.9700 ms 7.9878 ms]
                        thrpt:  [1.9714 GiB/s 1.9758 GiB/s 1.9802 GiB/s]
                 change:
                        time:   [−21.280% −20.793% −20.375%] (p = 0.00 < 0.05)
                        thrpt:  [+25.589% +26.251% +27.033%]
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mildaa
```
</details>

# Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->
No.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant