jpountz opened a new pull request, #14996:
URL: https://github.com/apache/lucene/pull/14996

   Lucene has call sites of `Bits#get` that are more polymorphic than they 
should because they sometimes receive a `FixedBitSet` as `Bits`, and sometimes 
a `FixedBits` (the return type of `FixedBitSet#asReadOnlyBits`). This makes 
some call sites bimorphic when they could be monomorphic, of polymorphic when 
they could be bimorphic (e.g. if `SparseFixedBitSet` also get used).
   
   Given how polymorphism affects performance, I would like to fix this 
performance trap. One idea would be to make `BitSet` no longer implement 
`Bits`, ie. you could no longer pass a `FixedBitSet` when `Bits` are expected, 
you would need to pass the result of `FixedBitSet#asReadOnlyBits`. This is what 
this PR does.
   
   I had to move/copy some APIs around between `Bits`, `BitSet` and 
`FixedBitSet` to make it work, but it's not as invasive as I initially worried.
   
   The API change is a 11.0 change, but we could backport the bits that reduce 
polymorphism to 10.x, ie. making sure to pass the result of 
`FixedBitSet#asReadOnlyBits` rather than the `FixedBitSet` directly when `Bits` 
are expected.


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