Skip to content

Exp1 is slower than Exp #1064

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

Closed
vks opened this issue Oct 27, 2020 · 3 comments
Closed

Exp1 is slower than Exp #1064

vks opened this issue Oct 27, 2020 · 3 comments

Comments

@vks
Copy link
Collaborator

vks commented Oct 27, 2020

Running the corresponding benchmarks from #1063, I get the following results:

test distr_exp1_general                    ... bench:       4,208 ns/iter (+/- 192) = 1901 MB/s
test distr_exp1_specialized                ... bench:       5,288 ns/iter (+/- 196) = 1512 MB/s

This contradicts our documentation:

Samples floating-point numbers according to the exponential distribution, with rate parameter λ = 1. This is equivalent to Exp::new(1.0) or sampling with -rng.gen::<f64>().ln(), but faster.

@dhardy
Copy link
Member

dhardy commented Nov 2, 2020

So the doc is wrong (likely depending on optimisations), but as I mentioned in the benchmark PR, there may still be reason to use this: saving space in a derived distribution.

@vks
Copy link
Collaborator Author

vks commented Apr 16, 2021

I cannot reproduce this on a more modern CPU, therefore I'll close this.

test distr_exp1_general                    ... bench:       2,868 ns/iter (+/- 56) = 2789 MB/s
test distr_exp1_specialized                ... bench:       2,633 ns/iter (+/- 74) = 3038 MB/s

@vks vks closed this as completed Apr 16, 2021
@dhardy
Copy link
Member

dhardy commented Apr 17, 2021

It could also be changes in the compiler. This is still a Haswell CPU:

test distr_exp1_general                    ... bench:       3,868 ns/iter (+/- 352) = 2068 MB/s
test distr_exp1_specialized                ... bench:       3,691 ns/iter (+/- 189) = 2167 MB/s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants