-
Notifications
You must be signed in to change notification settings - Fork 966
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
Copy collected acc(maxFreqs) into empty acc, rather than merge them. #12846
Conversation
@jpountz Please take a look when you get a chance. |
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.
Thanks for looking into this. Did you observe a speedup with this change? Also can you add a test?
lucene/core/src/java/org/apache/lucene/codecs/CompetitiveImpactAccumulator.java
Outdated
Show resolved
Hide resolved
@jpountz
Do you mean copy the treeset's all entries regardless wether they are competitice, into current accumulator wether it is empty or not, and does not remove less competitive entries which implemented in add phase? |
Sorry I wasn't clear, I meant to replace entries of the treeset with entries of the other treeset by clearing it first, and then doing an |
Sorry, I am still confused about this. If we clear an unEmpty treeset, how to deal with its competitive entries? |
This looks similar to the arraycopy that you perform on the |
@jpountz I applied copy for all level's empty acc, Please take a look when you get a chance. As so far I just performed copy on empty acc which cleared by |
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 think I liked your previous patch better before, when knowing when the accumulator is empty is the responsibility of the caller rather than CompetitiveFreqNormAccumulator
. Are there reasons why this did not work? Or is this new approach helping cover more cases maybe?
Yes, Previous patch only apply copy for level 0 's acc in
I will move the copy/addAll selection to caller. Before that, there are some performance data I want to share: First of all, I measured method execution time(without assertion):
And add the implementation to JMH to enable JIT's optimization(auto-unroll, auto-vectorization):
The speedup is not stable, so I split the implementation into array part and treeSet part.
ArrayMax is the baseline that iterates the array and get the max value.
I also measured the method performance without JMH:
The method performance indicates that Finally, I modified
Now |
@jpountz Please take a look when you get a chance! |
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution! |
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99SkipWriter.java
Outdated
Show resolved
Hide resolved
@jpountz |
lucene/core/src/java/org/apache/lucene/codecs/CompetitiveImpactAccumulator.java
Outdated
Show resolved
Hide resolved
@jpountz |
We could copy collected acc into buffered acc, rather than merge them, in bufferSkip phase.
Because the target CompetitiveImpactAccumulator is cleared in last writeSkipData phase.