Skip to content
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

Sort fix #74

Merged
merged 4 commits into from
Apr 8, 2022
Merged

Sort fix #74

merged 4 commits into from
Apr 8, 2022

Conversation

chriso
Copy link
Contributor

@chriso chriso commented Apr 8, 2022

This fixes a bug where the optimized sorting routines weren't used on ARM64 (where purego=true). It fixes another issue where the non-asm sorting routines were swapping items when they were equal.

I've added benchmarks for indirect sorting, and added tests for pivot selection to make sure we aren't triggering worst case quicksort behavior.

@tysonmote
Copy link

tysonmote commented Apr 8, 2022

Big improvement in cachette/lsm's sorting benchmarks, which I rigged up to sort 100K items that are randomly ordered and ordered ascending and descending:

name                            old time/op  new time/op  delta
BufferSort_sortedAscending-10   24.5ms ± 2%   3.3ms ± 1%   ~     (p=0.100 n=3+3)
BufferSort_sortedDescending-10  16.7ms ± 2%   3.4ms ± 2%   ~     (p=0.100 n=3+3)
BufferSort_random-10            8.49ms ± 1%  8.61ms ± 1%   ~     (p=0.200 n=3+3)

Copy link
Contributor

@kalamay kalamay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@chriso chriso merged commit 56bf31b into main Apr 8, 2022
@chriso chriso deleted the sort-fix branch April 8, 2022 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants