easyice commented on PR #12841:
URL: https://github.com/apache/lucene/pull/12841#issuecomment-1852013823
Hi, I added the implementation for `ByteBufferIndexInput`, Unfortunately,
the benchmark shows a bit regression:
java17
```
Benchmark (size)
Mode Cnt Score Error Units
GroupVIntBenchmark.benchMMapDirectoryInputs_readGroupVInt 64
thrpt 5 6.591 ± 1.333 ops/us
GroupVIntBenchmark.benchMMapDirectoryInputs_readGroupVIntBaseline 64
thrpt 5 7.253 ± 0.443 ops/us
```
Probably that the `ix()` has a bit overhead, or capturing lambda problem
like `NIOFSDirectory`?
DirectByteBuffer#getInt():
```java
public short getShort(int i) {
try {
return getShort(ix(checkIndex(i, (1 << 1))));
} finally {
Reference.reachabilityFence(this);
}
}
```
I ran with `-XX:+PrintInlining` parameter, it shows the methods are fully
inlined:
```
@ 139
org.apache.lucene.store.ByteBufferIndexInput$$Lambda$75/0x0000000800c84ca8::read
(9 bytes) inline (hot)
@ 5
org.apache.lucene.store.ByteBufferIndexInput::lambda$readGroupVInt$0 (10 bytes)
inline (hot)
! @ 6 java.nio.DirectByteBuffer::getInt
(28 bytes) inline (hot)
\-> TypeProfile (30309/30309 counts) =
java/nio/DirectByteBufferR
@ 5 java.nio.Buffer::checkIndex (24
bytes) inline (hot)
@ 8 java.nio.DirectByteBuffer::ix
(10 bytes) inline (hot)
! @ 11
java.nio.DirectByteBuffer::getInt (36 bytes) inline (hot)
@ 4 java.nio.Buffer::scope (17
bytes) force inline by annotation
! @ 13
jdk.internal.misc.ScopedMemoryAccess::getIntUnaligned (22 bytes) force inline
by annotation
! @ 6
jdk.internal.misc.ScopedMemoryAccess::getIntUnalignedInternal (38 bytes)
force inline by annotation
@ 17
jdk.internal.misc.Unsafe::getIntUnaligned (12 bytes) inline (hot)
@ 5
jdk.internal.misc.Unsafe::getIntUnaligned (83 bytes) (intrinsic)
@ 8
jdk.internal.misc.Unsafe::convEndian (16 bytes) inline (hot)
@ 23
java.lang.ref.Reference::reachabilityFence (1 bytes) force inline by
annotation
@ 21
java.lang.ref.Reference::reachabilityFence (1 bytes) force inline by
annotation
@ 16
java.lang.ref.Reference::reachabilityFence (1 bytes) force inline by
annotation
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]