jpountz commented on code in PR #12206:
URL: https://github.com/apache/lucene/pull/12206#discussion_r1137412879


##########
lucene/core/src/java/org/apache/lucene/store/ByteBuffersDataInput.java:
##########
@@ -71,7 +71,11 @@ public ByteBuffersDataInput(List<ByteBuffer> buffers) {
       this.blockMask = (1 << blockBits) - 1;
     }
 
-    this.size = Arrays.stream(blocks).mapToLong(block -> 
block.remaining()).sum();
+    long size = 0;
+    for (ByteBuffer block : blocks) {
+      size += block.remaining();
+    }
+    this.size = size;

Review Comment:
   When running some workloads with index sorting enabled, these two streams 
showed up on the profile and changing the logic to be more procedural indeed 
made things a bit faster. For reference, `toDataInput` is called on every 
unique term when index sorting is enabled, and ofter the postings list is short.



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