gsmiller commented on code in PR #12812:
URL: https://github.com/apache/lucene/pull/12812#discussion_r1420707913


##########
lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java:
##########
@@ -179,6 +179,19 @@ static class SlicedIntBlockPool extends IntBlockPool {
       super(allocator);
     }
 
+    /**
+     * For slices, buffers must be filled with zeros, so that we can find a 
slice's end based on a
+     * non-zero final value.
+     */
+    private static boolean assertSliceBuffer(int[] buffer) {
+      for (int value : buffer) {

Review Comment:
   Yeah, fair points. Was only pointing out why it may have been written the 
way it was. I'm honestly not concerned with how we write this check if it's 
only being used in asserts. I got thrown off since your PR leads with: "This PR 
makes it so we exit faster if we find a non-zero value", and was just pointing 
out that this may not be true. If this is only for assertions, then I don't 
think we really need to "optimize" it :). Avoiding overflow is good. You can do 
it this way, or with a disjunctive accumulator if you want to keep it 
branchless. But again, if only for assertions, whatever is simplest is fine 
with me.



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