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 int
private static final int[]
private static final int
private static final int
private final int[]
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
decode11To32
(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static void
decode12To32
(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static void
decode13To32
(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static void
decode14To32
(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static void
decode15To32
(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static void
decode16To32
(PostingDecodingUtil pdu, int[] ints) private static void
decode4To16
(PostingDecodingUtil pdu, int[] ints) private static void
decode5To16
(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static void
decode6To16
(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static void
decode7To16
(PostingDecodingUtil pdu, int[] tmp, int[] ints) private static void
decode8To16
(PostingDecodingUtil pdu, int[] ints) (package private) void
decodeAndPrefixSum
(int bitsPerValue, PostingDecodingUtil pdu, int base, int[] ints) Delta-decode 128 integers intoints
.(package private) void
decodeAndPrefixSum
(PostingDecodingUtil pdu, int base, int[] ints) Decode deltas, compute the prefix sum and addbase
to all decoded ints.(package private) void
encodeDeltas
(int[] ints, DataOutput out) Encode deltas of a strictly monotonically increasing sequence of integers.private static void
innerPrefixSum16
(int[] arr) private static void
innerPrefixSum8
(int[] arr) private static void
prefixSum16
(int[] arr, int base) private static void
prefixSum32
(int[] arr, int base) private static void
prefixSum8
(int[] arr, int base) private static void
prefixSumOfOnes
(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 providedints
are expected to be deltas between consecutive values.- Throws:
IOException
-
decodeAndPrefixSum
Decode deltas, compute the prefix sum and addbase
to 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
-