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.
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
Improve SmallRng initialization performance #1482
Improve SmallRng initialization performance #1482
Changes from 1 commit
5410c5d
bee90d1
4d6b651
76710d9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We aren't round-tripping to LE bytes and back since your code now directly initializes state, hence we don't want
.to_le()
here.This should trip a test, but it seems we never actually test
seed_from_u64
... because we don't guarantee value-stability forSmallRng
anyway. (In other words, this isn't strictly a bug, but you should still remove.to_le()
, and preferably also add some form of reference test for this method.)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.
If I remove it, won't the result be different than before on BE? I was trying to preserve that here. But yeah,kinda pointless w/o a test to ensure that it's correct.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.
Do you mean that this PR should add test for the expected state of the Rng after
seed_from_u64
?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.
There's a
reference
test in the same file, but in this case testing a single sample should be enough. And yes, results should match from prior to your PR.It doesn't really matter since we explicitly do not promise value stability of these RNGs, but feel like we should anyway.
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.
Done in bee90d1 and 4d6b651