java.lang.Object
org.apache.lucene.codecs.lucene912.ForDeltaUtil
Inspired from https://fulmicoton.com/posts/bitpacking/ Encodes multiple integers in a long to get
SIMD-like speedups. If bitsPerValue <= 4 then we pack 8 ints per long else if bitsPerValue
<= 11 we pack 4 ints per long else we pack 2 ints per long
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final long[]
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private final long[]
private static final int
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
decode12To32
(PostingDecodingUtil pdu, long[] tmp, long[] longs) private static void
decode13To32
(PostingDecodingUtil pdu, long[] tmp, long[] longs) private static void
decode14To32
(PostingDecodingUtil pdu, long[] tmp, long[] longs) private static void
decode15To32
(PostingDecodingUtil pdu, long[] tmp, long[] longs) private static void
decode16To32
(PostingDecodingUtil pdu, long[] tmp, long[] longs) private static void
decode5To16
(PostingDecodingUtil pdu, long[] tmp, long[] longs) private static void
decode6To16
(PostingDecodingUtil pdu, long[] tmp, long[] longs) private static void
decode7To16
(PostingDecodingUtil pdu, long[] tmp, long[] longs) private static void
decode8To16
(PostingDecodingUtil pdu, long[] tmp, long[] longs) (package private) void
decodeAndPrefixSum
(int bitsPerValue, PostingDecodingUtil pdu, long base, long[] longs) Delta-decode 128 integers intolongs
.(package private) void
decodeAndPrefixSum
(PostingDecodingUtil pdu, long base, long[] longs) Decode deltas, compute the prefix sum and addbase
to all decoded longs.(package private) void
encodeDeltas
(long[] longs, DataOutput out) Encode deltas of a strictly monotonically increasing sequence of integers.private static void
innerPrefixSum16
(long[] arr) private static void
innerPrefixSum32
(long[] arr) private static void
innerPrefixSum8
(long[] arr) private static void
prefixSum16
(long[] arr, long base) private static void
prefixSum32
(long[] arr, long base) private static void
prefixSum8
(long[] arr, long base) private static void
prefixSumOfOnes
(long[] arr, long base) (package private) void
skip
(IndexInput in)
-
Field Details
-
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:
-
ONE_BLOCK_SIZE_EIGHT
private static final int ONE_BLOCK_SIZE_EIGHT- See Also:
-
TWO_BLOCK_SIZE_EIGHTS
private static final int TWO_BLOCK_SIZE_EIGHTS- See Also:
-
THREE_BLOCK_SIZE_EIGHTS
private static final int THREE_BLOCK_SIZE_EIGHTS- See Also:
-
FOUR_BLOCK_SIZE_EIGHTS
private static final int FOUR_BLOCK_SIZE_EIGHTS- See Also:
-
FIVE_BLOCK_SIZE_EIGHTS
private static final int FIVE_BLOCK_SIZE_EIGHTS- See Also:
-
SIX_BLOCK_SIZE_EIGHTS
private static final int SIX_BLOCK_SIZE_EIGHTS- See Also:
-
SEVEN_BLOCK_SIZE_EIGHTS
private static final int SEVEN_BLOCK_SIZE_EIGHTS- See Also:
-
IDENTITY_PLUS_ONE
private static final long[] IDENTITY_PLUS_ONE -
tmp
private final long[] tmp
-
-
Constructor Details
-
ForDeltaUtil
public ForDeltaUtil()
-
-
Method Details
-
prefixSumOfOnes
private static void prefixSumOfOnes(long[] arr, long base) -
prefixSum8
private static void prefixSum8(long[] arr, long base) -
prefixSum16
private static void prefixSum16(long[] arr, long base) -
prefixSum32
private static void prefixSum32(long[] arr, long base) -
innerPrefixSum8
private static void innerPrefixSum8(long[] arr) -
innerPrefixSum16
private static void innerPrefixSum16(long[] arr) -
innerPrefixSum32
private static void innerPrefixSum32(long[] arr) -
encodeDeltas
Encode deltas of a strictly monotonically increasing sequence of integers. The providedlongs
are expected to be deltas between consecutive values.- Throws:
IOException
-
decodeAndPrefixSum
Decode deltas, compute the prefix sum and addbase
to all decoded longs.- Throws:
IOException
-
skip
- Throws:
IOException
-
decodeAndPrefixSum
void decodeAndPrefixSum(int bitsPerValue, PostingDecodingUtil pdu, long base, long[] longs) throws IOException Delta-decode 128 integers intolongs
.- Throws:
IOException
-
decode5To16
private static void decode5To16(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-
decode6To16
private static void decode6To16(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-
decode7To16
private static void decode7To16(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-
decode8To16
private static void decode8To16(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-
decode12To32
private static void decode12To32(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-
decode13To32
private static void decode13To32(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-
decode14To32
private static void decode14To32(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-
decode15To32
private static void decode15To32(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-
decode16To32
private static void decode16To32(PostingDecodingUtil pdu, long[] tmp, long[] longs) throws IOException - Throws:
IOException
-