jfboeuf commented on code in PR #13989: URL: https://github.com/apache/lucene/pull/13989#discussion_r1840804892
########## lucene/core/src/java/org/apache/lucene/store/BufferedChecksum.java: ########## @@ -60,6 +64,37 @@ public void update(byte[] b, int off, int len) { } } + void updateShort(short val) { + if (upto + Short.BYTES > buffer.length) flush(); + BitUtil.VH_LE_SHORT.set(buffer, upto, val); + upto += Short.BYTES; + } + + void updateInt(int val) { + if (upto + Integer.BYTES > buffer.length) flush(); + BitUtil.VH_LE_INT.set(buffer, upto, val); + upto += Integer.BYTES; + } + + void updateLong(long val) { + if (upto + Long.BYTES > buffer.length) flush(); + BitUtil.VH_LE_LONG.set(buffer, upto, val); + upto += Long.BYTES; + } + + void updateLongs(long[] vals, int offset, int len) { + flush(); Review Comment: I pushed the modification to limit the flush. Not only is the buffer no longer systematically flushed entering the `updateLongs(long[], int, int)` but also the last chunk is not flushed which results beneficial when in the likely case there is remaining data (the codec footer) after the `long[]` that could fit in the buffer. -- 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