easyice commented on PR #12841:
URL: https://github.com/apache/lucene/pull/12841#issuecomment-1852253188

   Even if i used the copy code approach(avoid to using lambda, for test 
purpose), it was only 15%-20% faster. 
   
   like this:
   
   ```
     @Override
     public void readGroupVInts(long[] dst, int limit) throws IOException {
       int i;
       for (i = 0; i <= limit - 4; i += 4) {
         readGroupVInt(dst, i);
       }
       for (; i < limit; ++i) {
         dst[i] = readVInt();
       }
     }
   
     private void readGroupVInt(long[] dst, int offset) throws IOException {
       final ByteBuffer buffer = curBuf;
       if (buffer.remaining() < GroupVIntUtil.MAX_LENGTH_PER_GROUP) {
         GroupVIntUtil.readGroupVInt(this, dst, offset);
         return;
       }
   
       final int flag = readByte() & 0xFF;
       ...
       dst[offset] = guard.getInt(buffer, curPosition) & 
GroupVIntUtil.MASKS[n1Minus1];
       ...
       buffer.position(curPosition);
     }
   ```
   
   copy code approach output:
   
   ```
   Benchmark                                                          (size)   
Mode  Cnt  Score   Error   Units
   GroupVIntBenchmark.benchMMapDirectoryInputs_readGroupVInt              64  
thrpt    5  8.991 ± 1.569  ops/us
   GroupVIntBenchmark.benchMMapDirectoryInputs_readGroupVIntBaseline      64  
thrpt    5  7.387 ± 0.268  ops/us
   ```


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