Skip to content
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

faster rand(::MersenneTwister, ::Union{[U]Int{8,16,32},Bool}) #25277

Merged
merged 1 commit into from
Dec 29, 2017

Conversation

rfourquet
Copy link
Member

Now that generating scalar Float64 values (i.e. 52 random bits) is even faster,
it becomes faster to just generate such values and make small integers out of
them, rather than saving entropy bits with using the integer cache.

I tested on two different machines, the observed speed-up ranges from 15% to 40%.

Now that generating scalar Float64 values (i.e. 52 random bits) is even faster,
it becomes faster to just generate such values and make small integers out of
them, rather than saving entropy bits with using the integer cache.
@rfourquet rfourquet added performance Must go faster randomness Random number generation and the Random stdlib labels Dec 27, 2017
@vtjnash
Copy link
Member

vtjnash commented Dec 27, 2017

IIUC, this changes the random number stream? We should make sure to run nanosoldier on this to have an idea of which tests that’ll affect.

@rfourquet
Copy link
Member Author

rfourquet commented Dec 28, 2017

this changes the random number stream?

Yes.

We should make sure to run nanosoldier on this to have an idea of which tests that’ll affect.

My recent invocation of Nanosoldier were not always showing the expected improvements, but let's see.

@nanosoldier runbenchmarks("random", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - no performance regressions were detected. A full report can be found here. cc @ararslan

@rfourquet
Copy link
Member Author

It's funny: Nanosoldier shows two improvements, which are consequences of the change here (for ComplexF32 and Complex{UInt32}), but not the most direct improvements for the small integer types.

@vtjnash
Copy link
Member

vtjnash commented Dec 28, 2017

I mean we should run it on all tests. Some of them are sensitive to the numbers themselves, so we will want to know which changes in the next daily are “noise”.

@rfourquet
Copy link
Member Author

Ah right, got it!
@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

@rfourquet
Copy link
Member Author

Freebsd CI failure is a timeout.

@rfourquet rfourquet merged commit ea5b0a3 into master Dec 29, 2017
@rfourquet rfourquet deleted the rf/rand/fast-smallints branch December 29, 2017 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster randomness Random number generation and the Random stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants