-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Optimize break patterns #107638
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 break patterns #107638
Conversation
r? @scottmcm (rustbot has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
195966c
to
1e81c81
Compare
I'm going to flip this over to the actual lib team, not me, since I don't know what the algorithms policy is for stuff like this (I also wonder if 64-bit randomness is even all that useful here, since the odds of someone sorting more than 2³² items seems incredibly low, and if they're really sorting/selecting more, maybe breaking patterns in "only" the local over-4GB-of-RAM-anyway area might be sufficient.) |
Thanks! Agree that the length of the slice greater than 2^32 is a rare case, but the |
Did you consider the 64-bit version of xorshift? ( In |
I think using the 64-bit version of the XORSHIFT is good. On my server, the WYHASH is just 40ps (about 5%~10%) faster than it. Considering |
1e81c81
to
2b14ea3
Compare
2b14ea3
to
3b4d6e0
Compare
@bors r+ rollup=never (for perf) |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
☀️ Test successful - checks-actions |
Finished benchmarking commit (6ffabf3): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
Wow! Are those cycle results legit? What's rustc sorting to get that? |
I think that may be recovering from a fluke in the prior cycles comparison that a regressed by the same amount. |
Use
wyrand
instead of callingXORSHIFT
2 times in break patterns for the 64-bit platform. The new PRNG is 2x faster than the previous one.Bench result(via https://gist.github.com/zhangyunhao116/11ef41a150f5c23bb47d86255fbeba89):