easyice commented on code in PR #13828:
URL: https://github.com/apache/lucene/pull/13828#discussion_r1778298810


##########
lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java:
##########
@@ -205,12 +208,16 @@ void readInts(IndexInput in, int count, int[] docIDs) 
throws IOException {
     }
   }
 
-  private static DocIdSetIterator readBitSetIterator(IndexInput in, int count) 
throws IOException {
+  private DocIdSetIterator readBitSetIterator(IndexInput in, int count) throws 
IOException {
     int offsetWords = in.readVInt();
     int longLen = in.readVInt();
-    long[] bits = new long[longLen];
-    in.readLongs(bits, 0, longLen);
-    FixedBitSet bitSet = new FixedBitSet(bits, longLen << 6);
+    if (longLen > scratchLongs.length) {
+      scratchLongs = ArrayUtil.growNoCopy(scratchLongs, longLen);
+    }
+    in.readLongs(scratchLongs, 0, longLen);
+    // make ghost bits clear
+    Arrays.fill(scratchLongs, longLen, scratchLongs.length, 0);

Review Comment:
   Good idea. If the current longLen is greater than the previous value, we 
don’t need to perform the clear.
   



-- 
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

Reply via email to