You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "iverase (via GitHub)" <gi...@apache.org> on 2026/06/03 08:21:39 UTC

[PR] Simplify how we collect hits in the LRU cache from a DocIdStream [lucene]

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

   We are currently using an intermediate buffer to collect those hits but it feels more natural to use the method DocIdStream#forEach to collect those. I actually asked an AI agent to check the performance of this change and it claims this way of collecting hits is faster, even when polluting the consumer with different implementations.
   
   Here are the summary of the results:
   
   ```
   Results (polymorphic consumer)
   
     ┌────────┬─────────┬─────────────┬───────────┬─────────┬───────────────────┐
     │ Stream │ Density │ Target      │ intoArray │ forEach │ forEach advantage │
     ├────────┼─────────┼─────────────┼───────────┼─────────┼───────────────────┤
     │ BITSET │ 1%      │ FixedBitSet │ 20.1 µs   │ 5.1 µs  │ ~4.0×             │
     │ BITSET │ 10%     │ FixedBitSet │ 177 µs    │ 33 µs   │ ~5.3×             │
     │ BITSET │ 50%     │ FixedBitSet │ 914 µs    │ 147 µs  │ ~6.2×             │
     │ BITSET │ 1%      │ Roaring     │ 19.2 µs   │ 5.4 µs  │ ~3.6×             │
     │ BITSET │ 10%     │ Roaring     │ 212 µs    │ 48 µs   │ ~4.4×             │
     │ BITSET │ 50%     │ Roaring     │ 982 µs    │ 202 µs  │ ~4.9×             │
     │ RANGE  │ 1%      │ FixedBitSet │ 3.0 µs    │ 2.6 µs  │ ~1.2×             │
     │ RANGE  │ 50%     │ FixedBitSet │ 261 µs    │ 145 µs  │ ~1.8×             │
     │ RANGE  │ 50%     │ Roaring     │ 235 µs    │ 193 µs  │ ~1.2×             │
     └────────┴─────────┴─────────────┴───────────┴─────────┴───────────────────┘
   
   ```


-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Simplify how we collect hits in the LRU cache from a DocIdStream [lucene]

Posted by "iverase (via GitHub)" <gi...@apache.org>.
iverase merged PR #16178:
URL: https://github.com/apache/lucene/pull/16178


-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org