-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use branchless way to speedup filterCompetitiveHits #14906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use branchless way to speedup filterCompetitiveHits #14906
Conversation
This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR. |
This reverts commit 4c352a4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested an alternative impl as a follow-up to Robert's comment, that uses conditional moves and looks faster: https://github.com/apache/lucene/pull/14906/files#r2189422844
Thank you !! That is amazing ! I pushed another commit according to your suggestion. |
The new impl is slightly slower on my ARM Mac, but it's still a similar order of magnitude and much faster than the baseline, and the code looks more idiomatic, so I think we're good to merge.
|
Co-authored-by: gesong.samuel <gesong.samuel@bytedance.com>
Nightly benchmarks caught up with this change. Good speedups on many queries. https://benchmarks.mikemccandless.com/OrMany.html |
I pushed an annotation. |
it's crazy that this helps. I have to think about things in a new way. I mean my old way of thinking is that the fewer things you ask the computer to do, the less work it has to do :) |
I'm the same way... but I think this stopped being true somewhere around mid- 90s. :) |
Description
This PR is part of #14896 from the comment . Propose to modify the
filterCompetitiveHits
in a branchless way, hopefully we can get partially auto-vectorized.Here is the luceneutil result on
wikimediumall
withsearchConcurrency=0, taskCountPerCat=5, taskRepeatCount=50
after 20 iterations: