-
Notifications
You must be signed in to change notification settings - Fork 197
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
Reduce bitshifts in from_u64_pair #790
Conversation
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.
lgtm
asembly wise both x86 and arm have much better, and shorter code-gen for the inherent methods, rather than the bit shifting, so I really can't understand the regressions, like how is this being tested exactly? EDIT:scrap that, yes your benches are in fact broken, you shouldn't use a literal value of the benching, since, the compiler just does all of the processing at compile time, so you are likely to have lost of weird behavior when benching, as it is essentially a no-op, you can use (black_box)[https://doc.rust-lang.org/std/hint/fn.black_box.html] and wrap the function arguments int, better yet start and before the benchmark generate a random value, the reuse it with blackbox #[bench]
fn from_u128(b: &mut Bencher) {
let id = rand::random::<u128>()
b.iter(|| Uuid::from_u128(std::hint::black_box(id)));
} |
Thanks @Vrtgs 👍 I hadn't dug into it yet. I'll probably just remove those benches, since I just sketched them out to ensure we didn't regress. |
Bumps uuid from 1.12.0 to 1.12.1. Release notes Sourced from uuid's releases. 1.12.1 What's Changed Fix links to namespaces in documentation by @cstyles in uuid-rs/uuid#789 use inherent to_be_bytes and to_le_bytes methods by @Vrtgs in uuid-rs/uuid#788 Reduce bitshifts in from_u64_pair by @KodrAus in uuid-rs/uuid#790 prepare for 1.12.1 release by @KodrAus in uuid-rs/uuid#791 New Contributors @cstyles made their first contribution in uuid-rs/uuid#789 @Vrtgs made their first contribution in uuid-rs/uuid#788 Full Changelog: uuid-rs/uuid@1.12.0...1.12.1 Commits 70831d2 Merge pull request #791 from uuid-rs/cargo/1.12.1 ddb8785 prepare for 1.12.1 release 3a0a378 Merge pull request #790 from uuid-rs/chore/fewer-shifts 62da97b remove sketchy benches 7a96ae2 restore parens cfc627b reduce bitshifts in from_u64_pair 4c785e5 Merge pull request #788 from Vrtgs/main 70efa18 Merge pull request #789 from cstyles/fix-links-to-namespaces 2a28bc5 Fix links to namespaces in documentation 5d629ce use inherint to_be_bytes and to_le_bytes methods, rather than reimplementing ... Additional commits viewable in compare view Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase. Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: @dependabot rebase will rebase this PR @dependabot recreate will recreate this PR, overwriting any edits that have been made to it @dependabot merge will merge this PR after your CI passes on it @dependabot squash and merge will squash and merge this PR after your CI passes on it @dependabot cancel merge will cancel a previously requested merge and block automerging @dependabot reopen will reopen this PR if it is closed @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Follow-up to #788
This PR reduces the size of the
from_u64_pair
function. I've also added some quick micro-benchmarks to check the performance impact of this and thefrom_u128
change. So far on my M1 MacBook Pro I'm seeing a roughly 3x regression, so will investigate more.