This is an automated email from the ASF dual-hosted git repository.
wgtmac pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new bb6a367ffe GH-55247: [C++][Parquet] Optimize ALP Decompress in clang +
x86 (#55248)
bb6a367ffe is described below
commit bb6a367ffe98a9655710860ac262ca653cf43b1d
Author: mwish <[email protected]>
AuthorDate: Wed Oct 28 22:09:02 2026 +0800
GH-55247: [C++][Parquet] Optimize ALP Decompress in clang + x86 (#55248)
### 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:**
- [x] AI
**Reviewed before submission by:**
- [x] Human
* GitHub Issue: #55247
Authored-by: mwish <[email protected]>
Signed-off-by: Gang Wu <[email protected]>
---
cpp/src/arrow/util/alp/alp_compression.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/cpp/src/arrow/util/alp/alp_compression.cc
b/cpp/src/arrow/util/alp/alp_compression.cc
index 6b40f4e39a..73028091f2 100644
--- a/cpp/src/arrow/util/alp/alp_compression.cc
+++ b/cpp/src/arrow/util/alp/alp_compression.cc
@@ -561,10 +561,13 @@ void AlpCompression<T>::Decompress(const
AlpEncodedVectorView<T>& encoded_view,
// Fused unFOR + decode loop: undo FOR in unsigned arithmetic, reinterpret
the
// result as signed encoded integers, then apply the normative decimal
decode.
const EncodedUnsigned frame_of_ref = for_info.frame_of_reference();
+ // Read the exponent/factor once. AlpInfo stores them as uint8_t, which may
+ // alias the output stores, so reading them inside the loop blocks
vectorization.
+ const AlpExponentAndFactor exponent_and_factor =
alp_info.GetExponentAndFactor();
for (size_t i = 0; i < output.size(); ++i) {
const EncodedUnsigned unfored_value = scratch[i] + frame_of_ref;
const EncodedSigned signed_value =
util::SafeCopy<EncodedSigned>(unfored_value);
- output[i] = AlpInlines<T>::DecodeValue(signed_value,
alp_info.GetExponentAndFactor());
+ output[i] = AlpInlines<T>::DecodeValue(signed_value, exponent_and_factor);
}
PatchExceptions<TargetType>(