Skip to content

GH-48277: [C++][Parquet] unpack with shuffle algorithm - #47994

Merged
pitrou merged 85 commits into
apache:mainfrom
AntoinePrv:new-bpacking
Feb 26, 2026
Merged

GH-48277: [C++][Parquet] unpack with shuffle algorithm#47994
pitrou merged 85 commits into
apache:mainfrom
AntoinePrv:new-bpacking

Conversation

@AntoinePrv

@AntoinePrvAntoinePrv commented Oct 29, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

The current bit-unpacking algorithm (which is implemented as a C++ code generator script in Python) does not fully leverage SIMD operations: all loads and some bitshifts use scalar operations, leaving performance on the table.

What changes are included in this PR?

  1. Devise new bit-unpacking algorithms that fully leverage SIMD operations, for various parameter values of (packed bit width, destination integer width, SIMD register size). Different algorithms are necessary for different parameter values, because of straddling issues with some bit offsets.

  2. Implement these new algorithms entirely in C++ using metaprogramming: the tables necessary for efficient SIMD swizzling and shifting are computed at compile-time using constexpr code (the exception is AVX-512 which is still using the legacy Python code generation script).

  3. Implement low-level generic fallbacks for SIMD operations that are not available in all SIMD instruction sets, such as some flavor of bit-shifting. These fallbacks are also being contributed to xsimd, but have not been merged there yet.

Benchmark results on a AVX2 CPU (AMD Zen 2) on Linux (Ubuntu 24.04):

  • Parquet decoding:

    • between 30% and 60% faster on DELTA_BINARY_PACKED integer decoding
    • up to 30% faster on RLE boolean decoding
  • Parquet reading:

    • around 60% faster on BIT_PACKED levels reading
    • up to 50% faster on RLE levels reading
    • up to 20% faster on reading or skipping OPTIONAL and REPEATED records

Are these changes tested?

Yes, by the current extensive bit-unpacking and Parquet decoding tests.

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@AntoinePrv
AntoinePrvforce-pushed the new-bpacking branch 4 times, most recently from d2743d4 to 6e72467CompareOctober 30, 2025 15:58
@AntoinePrv
AntoinePrvforce-pushed the new-bpacking branch 2 times, most recently from a7e4cd9 to 9efa59aCompareNovember 20, 2025 17:19
@AntoinePrv
AntoinePrvforce-pushed the new-bpacking branch 2 times, most recently from d01fdba to b28ea9bCompareNovember 27, 2025 09:57
@AntoinePrvAntoinePrv changed the title unpack with shuffle algorithmGH-48277: [C++][Parquet] unpack with shuffle algorithmNov 27, 2025
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #48277has been automatically assigned in GitHub to PR creator.

@AntoinePrv
AntoinePrv marked this pull request as ready for review November 27, 2025 14:03
@AntoinePrv

Copy link
Copy Markdown
CollaboratorAuthor

@pitrou apart from R-lint, this is looking pretty good.

@pitrou

Copy link
Copy Markdown
Member

@ursabot please benchmark lang=C++

@voltrondatabot

Copy link
Copy Markdown

Benchmark runs are scheduled for commit a4bfe8a. Watch https://buildkite.com/apache-arrow and https://conbench.ursa.dev for updates. A comment will be posted here when the runs are complete.

@conbench-apache-arrow

Copy link
Copy Markdown

Thanks for your patience. Conbench analyzed the 4 benchmarking runs that have been run so far on PR commit a4bfe8a.

There were 37 benchmark results indicating a performance regression:

The full Conbench report has more details.

@AntoinePrv

AntoinePrv commented Nov 28, 2025

Copy link
Copy Markdown
CollaboratorAuthor

@pitrou I'm running this locally, and I made an error when fixing ASAN over-reading problem.
These latest benchmarks are not doing well.

@pitrou

Copy link
Copy Markdown
Member

@ursabot please benchmark lang=C++

@voltrondatabot

Copy link
Copy Markdown

Benchmark runs are scheduled for commit dd3ec0d. Watch https://buildkite.com/apache-arrow and https://conbench.ursa.dev for updates. A comment will be posted here when the runs are complete.

@conbench-apache-arrow

Copy link
Copy Markdown

Thanks for your patience. Conbench analyzed the 4 benchmarking runs that have been run so far on PR commit dd3ec0d.

There were 19 benchmark results indicating a performance regression:

The full Conbench report has more details.

@pitrou

Copy link
Copy Markdown
Member

@ursabot please benchmark lang=C++

@voltrondatabot

Copy link
Copy Markdown

Benchmark runs are scheduled for commit 408ef04. Watch https://buildkite.com/apache-arrow and https://conbench.ursa.dev for updates. A comment will be posted here when the runs are complete.

@pitrou

Copy link
Copy Markdown
Member

@ursabot please benchmark lang=C++

@conbench-apache-arrow

Copy link
Copy Markdown

Thanks for your patience. Conbench analyzed the 0 benchmarking runs that have been run so far on PR commit 408ef04.

None of the specified runs were found on the Conbench server.

The full Conbench report has more details.

@conbench-apache-arrow

Copy link
Copy Markdown

Thanks for your patience. Conbench analyzed the 0 benchmarking runs that have been run so far on PR commit 408ef04.

None of the specified runs were found on the Conbench server.

The full Conbench report has more details.

@pitrou

Copy link
Copy Markdown
Member

@ursabot please benchmark lang=C++

@pitrou

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g cpp

@github-actions

Copy link
Copy Markdown

Revision: 8f18e86

Submitted crossbow builds: ursacomputing/crossbow @ actions-ca3d21ba99

TaskStatus
example-cpp-minimal-build-staticGitHub Actions
example-cpp-minimal-build-static-system-dependencyGitHub Actions
example-cpp-tutorialGitHub Actions
test-build-cpp-fuzzGitHub Actions
test-conda-cppGitHub Actions
test-conda-cpp-valgrindGitHub Actions
test-debian-13-cpp-amd64GitHub Actions
test-debian-13-cpp-i386GitHub Actions
test-debian-experimental-cpp-gcc-15GitHub Actions
test-fedora-42-cppGitHub Actions
test-ubuntu-22.04-cppGitHub Actions
test-ubuntu-22.04-cpp-20GitHub Actions
test-ubuntu-22.04-cpp-bundledGitHub Actions
test-ubuntu-22.04-cpp-emscriptenGitHub Actions
test-ubuntu-22.04-cpp-no-threadingGitHub Actions
test-ubuntu-24.04-cppGitHub Actions
test-ubuntu-24.04-cpp-bundled-offlineGitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundledGitHub Actions
test-ubuntu-24.04-cpp-gcc-14GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formatsGitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizerGitHub Actions

@pitroupitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 again

@rok

rok commented Feb 26, 2026

Copy link
Copy Markdown
Member

Benchmark runs are scheduled for commit 8f18e86. Watch https://buildkite.com/apache-arrow and https://conbench.arrow-dev.org for updates. A comment will be posted here when the runs are complete.

@rok

rok commented Feb 26, 2026

Copy link
Copy Markdown
Member

Commit 8f18e86 already has scheduled benchmark runs.

1 similar comment
@rok

rok commented Feb 26, 2026

Copy link
Copy Markdown
Member

Commit 8f18e86 already has scheduled benchmark runs.

@rok

rok commented Feb 26, 2026

Copy link
Copy Markdown
Member

@ursabot please benchmark lang=C++

@rok

rok commented Feb 26, 2026

Copy link
Copy Markdown
Member

Commit 8f18e86 already has scheduled benchmark runs.

@conbench-apache-arrow

Copy link
Copy Markdown

Thanks for your patience. Conbench analyzed the 3 benchmarking runs that have been run so far on PR commit 8f18e86.

There were 32 benchmark results indicating a performance regression:

The full Conbench report has more details.

@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit a0c9a4b.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 31 possible false positives for unstable benchmarks that are known to sometimes produce them.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@AntoinePrv@pitrou@voltrondatabot@rok@thisisnic