You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "jpountz (via GitHub)" <gi...@apache.org> on 2025/02/25 22:45:49 UTC
[PR] Fix optimization to help inline calls to live docs. [lucene]
jpountz opened a new pull request, #14294:
URL: https://github.com/apache/lucene/pull/14294
While doing benchmarks on indexes with deletions, I found a bug in `ScorerUtil`, which optimizes live docs for the wrong class: `FixedBitSet` instead of `FixedBit`. Another performance bug is that `FixedBits` did not override `Bits#applyMask` with a more efficient implementation.
--
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] Fix optimization to help inline calls to live docs. [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz commented on code in PR #14294:
URL: https://github.com/apache/lucene/pull/14294#discussion_r1971606728
##########
lucene/core/src/java/org/apache/lucene/search/ScorerUtil.java:
##########
@@ -113,22 +116,21 @@ static Scorable likelyTermScorer(Scorable scorable) {
/**
* Optimize {@link Bits} representing the set of accepted documents for the case when it is likely
- * implemented via a {@link FixedBitSet}. This helps make calls to {@link Bits#get(int)}
- * inlinable, which in-turn helps speed up query evaluation. This is especially helpful as
- * inlining will sometimes enable auto-vectorizing shifts and masks that are done in {@link
- * FixedBitSet#get(int)}.
+ * implemented as live docs. This helps make calls to {@link Bits#get(int)} inlinable, which
+ * in-turn helps speed up query evaluation. This is especially helpful as inlining will sometimes
+ * enable auto-vectorizing shifts and masks that are done in {@link FixedBitSet#get(int)}.
*/
- static Bits likelyFixedBitSet(Bits acceptDocs) {
- if (acceptDocs instanceof FixedBitSet) {
+ static Bits likelyLiveDocs(Bits acceptDocs) {
+ if (acceptDocs == null) {
+ return acceptDocs;
+ } else if (acceptDocs.getClass() == DEFAULT_ACCEPT_DOCS_CLASS) {
return acceptDocs;
- } else if (acceptDocs != null) {
- return new FilterBits(acceptDocs);
} else {
- return null;
+ return new FilterBits(acceptDocs);
}
}
- private static class FilterBits implements Bits {
+ static class FilterBits implements Bits {
Review Comment:
This is because I needed it in the test, which I had failed to check in. I have now checked it in, but your comment made me want to avoid making this class pkg-private, so I refactored the test. This class is now private again.
--
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] Fix optimization to help inline calls to live docs. [lucene]
Posted by "gf2121 (via GitHub)" <gi...@apache.org>.
gf2121 commented on code in PR #14294:
URL: https://github.com/apache/lucene/pull/14294#discussion_r1971084748
##########
lucene/core/src/java/org/apache/lucene/search/ScorerUtil.java:
##########
@@ -113,22 +116,21 @@ static Scorable likelyTermScorer(Scorable scorable) {
/**
* Optimize {@link Bits} representing the set of accepted documents for the case when it is likely
- * implemented via a {@link FixedBitSet}. This helps make calls to {@link Bits#get(int)}
- * inlinable, which in-turn helps speed up query evaluation. This is especially helpful as
- * inlining will sometimes enable auto-vectorizing shifts and masks that are done in {@link
- * FixedBitSet#get(int)}.
+ * implemented as live docs. This helps make calls to {@link Bits#get(int)} inlinable, which
+ * in-turn helps speed up query evaluation. This is especially helpful as inlining will sometimes
+ * enable auto-vectorizing shifts and masks that are done in {@link FixedBitSet#get(int)}.
*/
- static Bits likelyFixedBitSet(Bits acceptDocs) {
- if (acceptDocs instanceof FixedBitSet) {
+ static Bits likelyLiveDocs(Bits acceptDocs) {
+ if (acceptDocs == null) {
+ return acceptDocs;
+ } else if (acceptDocs.getClass() == DEFAULT_ACCEPT_DOCS_CLASS) {
return acceptDocs;
- } else if (acceptDocs != null) {
- return new FilterBits(acceptDocs);
} else {
- return null;
+ return new FilterBits(acceptDocs);
}
}
- private static class FilterBits implements Bits {
+ static class FilterBits implements Bits {
Review Comment:
Why we need to change this?
--
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] Fix optimization to help inline calls to live docs. [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz merged PR #14294:
URL: https://github.com/apache/lucene/pull/14294
--
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