uschindler commented on issue #15079:
URL: https://github.com/apache/lucene/issues/15079#issuecomment-3214079390

   Here is the example for a standard `MemorySegmentIndexInput#readByte()`:
   
   ```
   0.38%         2071          
jdk.internal.foreign.MemorySessionImpl#checkValidStateRaw() [Inlined code]
                                 at 
jdk.internal.misc.ScopedMemoryAccess#getByteInternal() [Inlined code]
                                 at 
jdk.internal.misc.ScopedMemoryAccess#getByte() [Inlined code]
                                 at 
java.lang.invoke.VarHandleSegmentAsBytes#get() [Inlined code]
                                 at 
java.lang.invoke.LambdaForm$DMH.0x00007ff76d191c00#invokeStatic() [Inlined code]
                                 at 
java.lang.invoke.LambdaForm$MH.0x00007ff76d193000#invoke() [Inlined code]
                                 at 
java.lang.invoke.VarHandleGuards#guard_LJ_I() [Inlined code]
                                 at 
jdk.internal.foreign.AbstractMemorySegmentImpl#get() [Inlined code]
                                 at 
org.apache.lucene.store.MemorySegmentIndexInput#readByte() [Inlined code]
                                 at 
org.apache.lucene.codecs.lucene103.PForUtil#decode() [JIT compiled code]
                                 at 
org.apache.lucene.codecs.lucene103.Lucene103PostingsReader$BlockPostingsEnum#refillPositions()
 [JIT compiled code]
                                 at 
org.apache.lucene.codecs.lucene103.Lucene103PostingsReader$BlockPostingsEnum#nextPosition()
 [Inlined code]
   ```
   
   Here you see the Varhandle code is inlined. I have no idea why this does not 
happen for the GroupVInt code. I have some ideas.
   
   @easyice: Do you think we could change ReadGroupVintUtil to be an instance 
class instead of purely static. The we could add a getter to IndexInput to 
retrieve an instance for the given IndexInput that can read and decode 
IndexInputs. All VarHandles and the delegate would be final fields in that 
instance and therefor are better to inline. 
   
   I think the whole problem with the lambda and also those VarHandles here is 
the fact that the JVM cannot assume them to be static (as the captures for the 
lambda) and/or singletons (the VarHandle is static, but the delegate is passed 
on each call).
   
   The main problem of the current code is the "callback", i think we can 
revisit this. Let me think about it a bit over the weekend.


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