mirror of https://github.com/apache/lucene.git
LUCENE-9822: Assert that ForUtil.BLOCK_SIZE can be PFOR-encoded in a single byte
For/PFor code has BLOCK_SIZE=128 as a static final constant, with a lot of assumptions and optimizations for that case. For example it will encode 3 exceptions at most and optimizes the exception encoding with a single byte. This would not work at all if you changed the constant in the code to something like 512, but an assertion at an early stage helps make experimentation less painful, and better "documents" the assumption of how the exception encoding currently works.
This commit is contained in:
parent
231e3afe06
commit
8e337ab63f
|
@ -266,6 +266,8 @@ Other
|
|||
|
||||
* LUCENE-9773: Upgrade icu to 68.2 (Robert Muir)
|
||||
|
||||
* LUCENE-9822: Add assertion to PFOR exception encoding, documenting the BLOCK_SIZE assumption. (Greg Miller)
|
||||
|
||||
======================= Lucene 8.9.0 =======================
|
||||
|
||||
API Changes
|
||||
|
|
|
@ -37,6 +37,7 @@ final class PForUtil {
|
|||
private final ForUtil forUtil;
|
||||
|
||||
PForUtil(ForUtil forUtil) {
|
||||
assert ForUtil.BLOCK_SIZE <= 256 : "blocksize must fit in one byte. got " + ForUtil.BLOCK_SIZE;
|
||||
this.forUtil = forUtil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue