easyice commented on PR #12841: URL: https://github.com/apache/lucene/pull/12841#issuecomment-1846510407
> Thank you for sharing the code, it seems very clear, another way, could we pass the current block(ByteBuffer) to the decode function like below? this will keep the remaining bytes checking in each indexinputs. > > ```java > private void readGroupVInt(long[] dst, int offset) throws IOException { > if (buffer.remaining() < GroupVIntUtil.MAX_LENGTH_PER_GROUP) { > GroupVIntUtil.readGroupVInt(this, dst, offset); > return; > } > int pos = buffer.position(); > int len = GroupVIntUtil.readGroupVIntFromByteBuffer(buffer, pos, dst, offset); > buffer.position(pos + len); > } > ``` Thank you for quick impl Adrien, for reference, i tried this approach [code link](https://github.com/easyice/lucene/commit/13851013e98ff8e27f05fa6dc4bc2e450ea6c03d#diff-c81a04bd13d225f3a2dc2c47bde9590686fe5bb0a197c99eeec1a35bf2cc04cc) ,it's no performance regression on `NIOFSDirectory` and `ByteBuffersDataInput`, but terrible performance on `MemorySegment`: ``` Benchmark (size) Mode Cnt Score Error Units GroupVIntBenchmark.mmap_byteBufferReadGroupVIntBaseline 64 thrpt 5 5.395 ± 0.228 ops/us GroupVIntBenchmark.mmap_byteBufferReadGroupVIntUseByteBuffer 64 thrpt 5 1.394 ± 1.848 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