Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consider using our own PRNG in rayon-core #570

Closed
cuviper opened this issue Apr 27, 2018 · 0 comments
Closed

Consider using our own PRNG in rayon-core #570

cuviper opened this issue Apr 27, 2018 · 0 comments

Comments

@cuviper
Copy link
Member

cuviper commented Apr 27, 2018

We have a kludge in .travis.yml to deal with rand and its rustc compatibility. It would be nice to do better here.

We currently use rand in two ways:

  • Some tests use randomized input, often seeded.
  • Worker threads randomize which other threads they try to steal from.

We only run tests on nightly right now (barring #536), so only the use by worker threads matters for rustc compatibility in general. We use rand::weak_rng() for that, but it would probably be just fine to implement a simple PRNG locally. Then we could get rid of the compatibility kludge, and just keep rand as a dev-dependency.

FWIW, rand is also reconsidering its compatibility story in rust-random/rand#413.

bors bot added a commit that referenced this issue Jun 5, 2018
571: Implement our own PRNG for rayon-core r=nikomatsakis a=cuviper

Our need for randomness is very simple, just to spread the work-stealing
somewhat equally across all possible victims.  Rather than worrying
about compatibility and updates to the `rand` crate, we now implement a
simple `xorshift*` generator for this.  We keep `rand` only as a dev-
dependency for testing purposes.

Closes #570.

Co-authored-by: Josh Stone <cuviper@gmail.com>
@bors bors bot closed this as completed in #571 Jun 5, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant