-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Optimize prefix sum computation in Lucene99HnswVectorsReader; fixes #15024 #15027
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
base: main
Are you sure you want to change the base?
Optimize prefix sum computation in Lucene99HnswVectorsReader; fixes #15024 #15027
Conversation
Replaced the two-step prefix sum loop in `Lucene99HnswVectorsReader` with a single-loop variant that avoids redundant memory access and improves performance. Previous approach: - Read first value separately. - Then used previous buffer element + readVInt(). New approach: - Accumulates sum in a single pass and assigns directly. This change follows the suggestion from issue apache#14979 and has the same functional behavior with slightly better efficiency.
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. |
Thank you, this looks good. If you have cycles to run benchmarks, this would be appreciated, you can check out this: https://github.com/mikemccand/luceneutil/blob/main/README.md#running-the-knn-benchmark. |
Thank you, Glad it looks good. Also, I’ll take a look at the benchmark tool you linked and try to run some comparisons if time allows. Appreciate the reference! |
The only missing thing is an entry in lucene/CHANGES.txt but we can deal with it later. |
Perfect. |
@yossev FYI you'll need to resolve conflicts since another change touched the same lines of code. I'm curious if you had any success with benchmarking? |
Thanks for the heads-up! I noticed that the recent changes in Regarding benchmarking ,I’ll run it after the conflicts are resolved so results reflect the latest code. |
I was just giving credit to #14979 to the optimization i made in this case, not saying it changed anything. |
…prefix sum computation with GroupVIntUtil
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. |
@yossev see the output of the build failure, the build is unhappy with formatting, you need to run |
Replaced the two-step prefix sum loop in
Lucene99HnswVectorsReader
with a single-loop variant that avoids redundant memory access and improves performance.Previous approach:
New approach:
This change follows the suggestion from issue #14979 and has the same functional behavior with slightly better efficiency.