Skip to content

Use PriorityQueue instead of TreeMap in FirstPassGroupingCollector. #14813

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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

vsop-479
Copy link
Contributor

Description

Copy link

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.

@vsop-479
Copy link
Contributor Author

Benchmark:

Benchmark                                   Mode  Cnt   Score    Error   Units
PriorityQueueBenchmark.getTopNWithHeap     thrpt   15  ≈ 10⁻³           ops/us
PriorityQueueBenchmark.getTopNWithTreeMap  thrpt   15  ≈ 10⁻⁴           ops/us

@vsop-479
Copy link
Contributor Author

I added a new benchmark (FirstPassGroupingBenchmark) to simulate FirstPassGroupingCollector 's implementation.
It seems use heap can gain a better performance:

Benchmark                                       Mode  Cnt  Score   Error   Units
FirstPassGroupingBenchmark.getTopNWithHeap     thrpt   15  0.010 ± 0.002  ops/us
FirstPassGroupingBenchmark.getTopNWithTreeMap  thrpt   15  0.005 ± 0.001  ops/us

@vsop-479
Copy link
Contributor Author

Emm~, Use heap will remove(pop) element in orderedGroups, which will result in TestGrouping#testRandom fail, since this test case getTopGroups many times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant