mcimadamore commented on PR #912:
URL: https://github.com/apache/lucene/pull/912#issuecomment-1325173861

   > > More investigation is required to understand where the difference comes 
from.
   > 
   > After playing a bit more with the benchmark, it looks like 1ns is coming 
from the various alignment checks we need to perform - whereas ~0.5ns is coming 
from the segment liveness check. Of course, since this is a single call, the 
cost for these checks cannot be amortized. We can probably improve things a 
little (esp. when there's no alignment involved), but the numbers above reflect 
the fact that the memory segment implementation has more checks, so at the 
nanosecond scale, everything matters of course.
   
   With few optimization (to skip some checks when unaligned layouts are used, 
as well as to optimize other checks), I can get down to this (*):
   
   ```
   Benchmark                 (ELEM_SIZE)  Mode  Cnt   Score   Error  Units
   SegmentCopy.segment_copy            5  avgt   30   4.985 ± 0.030  ns/op
   SegmentCopy.segment_copy           10  avgt   30   4.853 ± 0.144  ns/op
   SegmentCopy.segment_copy           50  avgt   30   5.926 ± 0.066  ns/op
   SegmentCopy.segment_copy          100  avgt   30   8.272 ± 0.203  ns/op
   SegmentCopy.segment_copy          500  avgt   30  34.983 ± 0.226  ns/op
   SegmentCopy.segment_copy         1000  avgt   30  31.683 ± 0.161  ns/op
   ```
   
   (*) To reduce the cost of the liveness check I had to use a shared session, 
as the confinement check seems to be the main offender there.
   
   That said, before we go deeper in this kind of micro-optimizations, it would 
be better to understand if this is really the underlying cause behind the 
performance regression.


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