jpountz commented on code in PR #14910: URL: https://github.com/apache/lucene/pull/14910#discussion_r2213832113
########## lucene/core/src/java/org/apache/lucene/internal/vectorization/BitSetUtil.java: ########## @@ -30,11 +34,11 @@ class BitSetUtil { * stored in the provided {@code array}. * * <p>NOTE: Caller need to ensure the {@code array} has a length greater than or equal to {@code - * bitSet.cardinality(from, to) + 1}. + * bitSet.cardinality(from, to) + 16}. */ - static int denseBitsetToArray(FixedBitSet bitSet, int from, int to, int base, int[] array) { - assert bitSet.cardinality(from, to) + 1 <= array.length - : "Array length must be at least bitSet.cardinality(from, to) + 1"; + public final int bitsetToArray(FixedBitSet bitSet, int from, int to, int base, int[] array) { + assert bitSet.cardinality(from, to) + 16 <= array.length + : "Array length must be at least bitSet.cardinality(from, to) + 16"; Objects.checkFromToIndex(from, to, bitSet.length()); Review Comment: I wonder if we should refactor this `bitsetToArray` method to compute the bitCount of each word up-front to reduce dependencies between iterations of this loop (we rely on the result of `wordToArray` to know the next index at which to start writing data, so we can't start the next iteration of the loop before the current one is finished). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org