-
Notifications
You must be signed in to change notification settings - Fork 68
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
Optimize ord implementation and signed zero canonicalization #144
Merged
Conversation
This file contains 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
For example, example::old_leq:
vucomiss xmm1, xmm0
jae .LBB0_1
mov al, 1
vucomiss xmm0, xmm1
jae .LBB0_5
mov al, -1
vucomiss xmm0, xmm0
jp .LBB0_4
.LBB0_5:
inc al
cmp al, 2
setb al
ret
.LBB0_1:
xor eax, eax
vucomiss xmm0, xmm1
sbb eax, eax
inc al
cmp al, 2
setb al
ret
.LBB0_4:
vucomiss xmm1, xmm1
setnp al
inc al
cmp al, 2
setb al
ret to this: example::new_leq:
vcmpleps xmm0, xmm0, xmm1
vxorps xmm2, xmm2, xmm2
vcmpunordps xmm1, xmm1, xmm2
vorps xmm0, xmm1, xmm0
vmovd eax, xmm0
and al, 1
ret |
mbrubeck
approved these changes
Oct 10, 2023
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.
Thank you!
@mbrubeck To also give some concrete numbers, on my Apple M1 machine sorting a shuffled Vec of 1 million |
3 tasks
maxdeviant
referenced
this pull request
in zed-industries/zed
Aug 8, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ordered-float](https://github.com/reem/rust-ordered-float) | workspace.dependencies | patch | `2.10.0` -> `2.10.1` | --- ### Release Notes <details> <summary>reem/rust-ordered-float (ordered-float)</summary> ### [`v2.10.1`](https://github.com/reem/rust-ordered-float/releases/tag/v2.10.1) [Compare Source](https://github.com/reem/rust-ordered-float/compare/v2.10.0...v2.10.1) #### What's Changed - Refactor Hash implementation by [@​jogru0](https://github.com/jogru0) in [https://github.com/reem/rust-ordered-float/pull/129](https://github.com/reem/rust-ordered-float/pull/129) - Optimize Ord implementation by [@​orlp](https://github.com/orlp) in [https://github.com/reem/rust-ordered-float/pull/144](https://github.com/reem/rust-ordered-float/pull/144) **Full Changelog**: reem/rust-ordered-float@v2.10.0...v2.10.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone America/New_York, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- Release Notes: - N/A <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yMC4xIiwidXBkYXRlZEluVmVyIjoiMzguMjAuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.
These micro-optimizations significantly reduce the number of instructions comparisons take, and often makes them branchless as well. Similarly we use a trick to canonicalize signed zero to positive zero in a single instruction without branches for faster hashing.