switch from heap-based partialSort to quickselect#25
Merged
Conversation
Member
Author
|
@isaacl Based on your hint that decoding can be optimized if we don't need the sorted list. |
e52aabd to
d64d8df
Compare
isaacl
reviewed
Nov 11, 2025
isaacl
reviewed
Nov 11, 2025
Before (based on 13a0d52): HuffmanPgnBench.decode avgt 40 4297.839 ± 63.417 us/op After: HuffmanPgnBench.decode avgt 40 3344.431 ± 15.417 us/op # quickselect only <-- HuffmanPgnBench.decode avgt 20 3344.925 ± 31.764 us/op # insertionSortCutoff = 3 HuffmanPgnBench.decode avgt 20 3345.941 ± 29.388 us/op # insertionSortCutoff = 4 HuffmanPgnBench.decode avgt 40 3370.571 ± 24.539 us/op # insertionSortCutoff = 5 HuffmanPgnBench.decode avgt 40 3365.226 ± 25.166 us/op # insertionSortCutoff = 6 HuffmanPgnBench.decode avgt 120 3390.946 ± 17.816 us/op # insertionSortCutoff = 7 HuffmanPgnBench.decode avgt 40 3415.760 ± 27.759 us/op # sortCutoff = 4 HuffmanPgnBench.decode avgt 40 3431.564 ± 17.375 us/op # sortCutoff = 5 HuffmanPgnBench.decode avgt 40 3437.750 ± 23.575 us/op # sortCutoff = 6 HuffmanPgnBench.decode avgt 40 3430.231 ± 30.012 us/op # sortCutoff = 7 HuffmanPgnBench.decode avgt 40 3430.460 ± 16.339 us/op # sortCutoff = 8 HuffmanPgnBench.decode avgt 40 3504.320 ± 20.214 us/op # sortCutoff = 10
Member
Author
|
Rebased and reevaluated. Switching from quickselect to sorting no longer seems to do much. |
Member
|
fyi -- before the rebase/merge from master, I tested Arrays.sort and saw as a bit slower than your insertionSort for 7 elements. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before (based on 13a0d52):
After: