Skip to content

Commit 7dd9912

Browse files
committed
ALP: Inline decode with hoisted multipliers for double decompression
Hoist DOUBLE_POW10[factor] and DOUBLE_POW10_NEGATIVE[exponent] lookups out of the decode loop and inline the multiplication directly, avoiding per-element method call overhead and enabling better JIT vectorization. Only applied to the double path; float decode keeps the decodeFloat() method call as JIT produces better code for the smaller method.
1 parent c24b6a0 commit 7dd9912

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

parquet-column/src/main/java/org/apache/parquet/column/values/alp/AlpCompression.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,13 @@ static void decompressDoubleVector(DoubleCompressedVector v, double[] output, lo
411411
}
412412
}
413413

414-
for (int i = 0; i < v.numElements; i++) {
415-
long unfored = encodedBuffer[i] + v.frameOfReference;
416-
output[i] = AlpEncoderDecoder.decodeDouble(unfored, v.exponent, v.factor);
414+
// Fused unFOR + decode with hoisted multipliers
415+
final long frameOfRef = v.frameOfReference;
416+
final double factorMul = DOUBLE_POW10[v.factor];
417+
final double expMul = DOUBLE_POW10_NEGATIVE[v.exponent];
418+
final int numElements = v.numElements;
419+
for (int i = 0; i < numElements; i++) {
420+
output[i] = (double) (encodedBuffer[i] + frameOfRef) * factorMul * expMul;
417421
}
418422

419423
for (int i = 0; i < v.numExceptions; i++) {

0 commit comments

Comments
 (0)