Skip to content

Conversation

@pitdicker
Copy link
Contributor

A small optimization and some clean-up around Bernoulli::new. I added some comments to describe the method, and removed the useless "undefined behaviour" test because it does not apply.

Benchmarks before:

test misc_gen_bool_const             ... bench:       4,266 ns/iter (+/- 48)
test misc_gen_bool_var               ... bench:       6,239 ns/iter (+/- 63)
test misc_bernoulli_const            ... bench:       3,978 ns/iter (+/- 24)
test misc_bernoulli_var              ... bench:       6,299 ns/iter (+/- 6)

After:

test misc_gen_bool_const             ... bench:       3,990 ns/iter (+/- 12)
test misc_gen_bool_var               ... bench:       5,984 ns/iter (+/- 90)
test misc_bernoulli_const            ... bench:       3,976 ns/iter (+/- 8)
test misc_bernoulli_var              ... bench:       5,946 ns/iter (+/- 56)

@pitdicker pitdicker force-pushed the optimize_bernoulli_new branch from 7facd3f to 37eec71 Compare June 7, 2018 16:57
@pitdicker pitdicker changed the title Optimize bernoulli new Optimize Bernoulli::new Jun 7, 2018
@pitdicker pitdicker force-pushed the optimize_bernoulli_new branch from 37eec71 to 6044cc8 Compare June 9, 2018 15:20
@pitdicker pitdicker merged commit ec3d7ef into rust-random:master Jun 9, 2018
@pitdicker pitdicker deleted the optimize_bernoulli_new branch June 9, 2018 15:33
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

Successfully merging this pull request may close these issues.

2 participants