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


##########
lucene/core/src/java/org/apache/lucene/store/OutputStreamIndexOutput.java:
##########
@@ -135,5 +135,19 @@ void writeLong(long i) throws IOException {
       BitUtil.VH_LE_LONG.set(buf, count, i);
       count += Long.BYTES;
     }
+
+    @Override
+    public void write(int b) throws IOException {
+      // override single byte write to avoid synchronization overhead now that 
JEP374 removed biased
+      // locking
+      byte[] buffer = buf;
+      int count = this.count;
+      if (count >= buffer.length) {
+        super.write(b);
+      } else {
+        buffer[count] = (byte) b;
+        this.count = count + 1;
+      }
+    }

Review Comment:
   Should we implement it using the same pattern as 
`writeShort`/`writeInt`/`writeLong`?



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