Skip to content

GH-55247: [C++][Parquet] Optimize ALP Decompress in clang - #55248

Open
mapleFU wants to merge 1 commit into
apache:mainfrom
mapleFU:try-to-optimize-alp-in-clang
Open

mapleFU wants to merge 1 commit into
apache:mainfrom
mapleFU:try-to-optimize-alp-in-clang

Conversation

@mapleFU

@mapleFU mapleFU commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

See: https://godbolt.org/z/EPPqn7xco

What changes are included in this PR?

Extract the alp argument out, this brings optimization in clang ( at least clang-18 ).

According to the godbolt, gcc can optimize this well, so using gcc might not seeing this optimization.

Are these changes tested?

No

Are there any user-facing changes?

No

Was AI used for this PR?

AI help me to test the cases in different machines

PR code and description written by:

  • AI

Reviewed before submission by:

  • Human

Copilot AI balanced review requested due to automatic review settings October 25, 2026 11:10
@mapleFU mapleFU changed the title [C++][Parquet] Optimize ALP Decompress in clang GH-55247: [C++][Parquet] Optimize ALP Decompress in clang Oct 25, 2026
@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format.

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}

After updating the title, you can mark the pull request as ready for review.

See also:

@github-actions
github-actions Bot marked this pull request as draft October 25, 2026 11:10
@github-actions github-actions Bot added the awaiting review Awaiting review label Oct 25, 2026
@github-actions

Copy link
Copy Markdown

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

@mapleFU
mapleFU marked this pull request as ready for review October 25, 2026 11:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The localized change preserves decoding semantics and has no identified blocking issues; performance gains were not independently verified.

No open issues 🎉

What changed in this PR

This PR hoists ALP exponent/factor retrieval out of the C++ decompression loop to improve Clang vectorization without changing decoding behavior.

Changes:

  • Copies exponent/factor metadata once before decoding.
  • Documents how reading the byte-sized metadata inside the loop can inhibit vectorization.
File Description
cpp/​src/​arrow/​util/​alp/​alp_compression.cc Reuses cached exponent/factor metadata throughout the decode loop.

Review effort: Balanced

@mapleFU

mapleFU commented Oct 25, 2026 •

Copy link
Copy Markdown
Member Author

Benchmark result on my EPYC EPYC 9654 and clang++18

benchmark | before | after | improvement
-- | -- | -- | --
BM_AlpDecodingFloat/1024 | 1015 ns | 354 ns | 2.9x
BM_AlpDecodingFloat/4096 | 3390 ns | 786 ns | 4.3x
BM_AlpDecodingFloat/32768 | 25.4 µs | 4.4–5.5 µs | 4.6–5.8x
BM_AlpDecodingFloat/65536 | 50.0 µs | 8.6 µs | 5.8x
BM_AlpDecodingDouble/65536 | 52.4 µs | 43.8 µs | 1.2x

@mapleFU
mapleFU requested review from pitrou and wgtmac October 25, 2026 15:24
Sign up for free to 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.

2 participants