java.lang.Object
org.apache.lucene.codecs.lucene101.ForDeltaUtil
Inspired from https://fulmicoton.com/posts/bitpacking/ Encodes multiple integers in a Java int to
get SIMD-like speedups. If bitsPerValue <= 4 then we pack 4 ints per Java int else if
bitsPerValue <= 11 we pack 2 ints per Java int else we use scalar operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final int[]private static final intprivate static final intprivate final int[]private static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voiddecode11To32(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static voiddecode12To32(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static voiddecode13To32(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static voiddecode14To32(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static voiddecode15To32(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static voiddecode16To32(PostingDecodingUtil pdu, int[] ints) private static voiddecode4To16(PostingDecodingUtil pdu, int[] ints) private static voiddecode5To16(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static voiddecode6To16(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static voiddecode7To16(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static voiddecode8To16(PostingDecodingUtil pdu, int[] ints) (package private) voiddecodeAndPrefixSum(int bitsPerValue, PostingDecodingUtil pdu, int base, int[] ints) Delta-decode 128 integers intoints.(package private) voiddecodeAndPrefixSum(PostingDecodingUtil pdu, int base, int[] ints) Decode deltas, compute the prefix sum and addbaseto all decoded ints.(package private) voidencodeDeltas(int[] ints, DataOutput out) Encode deltas of a strictly monotonically increasing sequence of integers.private static voidinnerPrefixSum16(int[] arr) private static voidinnerPrefixSum8(int[] arr) private static voidprefixSum16(int[] arr, int base) private static voidprefixSum32(int[] arr, int base) private static voidprefixSum8(int[] arr, int base) private static voidprefixSumOfOnes(int[] arr, int base)
-
Field Details
-
HALF_BLOCK_SIZE
private static final int HALF_BLOCK_SIZE- See Also:
-
ONE_BLOCK_SIZE_FOURTH
private static final int ONE_BLOCK_SIZE_FOURTH- See Also:
-
TWO_BLOCK_SIZE_FOURTHS
private static final int TWO_BLOCK_SIZE_FOURTHS- See Also:
-
THREE_BLOCK_SIZE_FOURTHS
private static final int THREE_BLOCK_SIZE_FOURTHS- See Also:
-
IDENTITY_PLUS_ONE
private static final int[] IDENTITY_PLUS_ONE -
tmp
private final int[] tmp
-
-
Constructor Details
-
ForDeltaUtil
public ForDeltaUtil()
-
-
Method Details
-
prefixSumOfOnes
private static void prefixSumOfOnes(int[] arr, int base) -
prefixSum8
private static void prefixSum8(int[] arr, int base) -
prefixSum16
private static void prefixSum16(int[] arr, int base) -
prefixSum32
private static void prefixSum32(int[] arr, int base) -
innerPrefixSum8
private static void innerPrefixSum8(int[] arr) -
innerPrefixSum16
private static void innerPrefixSum16(int[] arr) -
encodeDeltas
Encode deltas of a strictly monotonically increasing sequence of integers. The providedintsare expected to be deltas between consecutive values.- Throws:
IOException
-
decodeAndPrefixSum
Decode deltas, compute the prefix sum and addbaseto all decoded ints.- Throws:
IOException
-
decodeAndPrefixSum
void decodeAndPrefixSum(int bitsPerValue, PostingDecodingUtil pdu, int base, int[] ints) throws IOException Delta-decode 128 integers intoints.- Throws:
IOException
-
decode4To16
- Throws:
IOException
-
decode5To16
- Throws:
IOException
-
decode6To16
- Throws:
IOException
-
decode7To16
- Throws:
IOException
-
decode8To16
- Throws:
IOException
-
decode11To32
- Throws:
IOException
-
decode12To32
- Throws:
IOException
-
decode13To32
- Throws:
IOException
-
decode14To32
- Throws:
IOException
-
decode15To32
- Throws:
IOException
-
decode16To32
- Throws:
IOException
-