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

Speed-up statistics.NormalDist.samples() #108322

Closed
rhettinger opened this issue Aug 22, 2023 · 0 comments
Closed

Speed-up statistics.NormalDist.samples() #108322

rhettinger opened this issue Aug 22, 2023 · 0 comments
Assignees
Labels
3.13 new features, bugs and security fixes performance Performance or resource usage

Comments

@rhettinger
Copy link
Contributor

rhettinger commented Aug 22, 2023

Currently, samples() calls random.gauss(). It would be several times faster to use the inverse CDF method instead.

Linked PRs

@rhettinger rhettinger added performance Performance or resource usage 3.13 new features, bugs and security fixes labels Aug 22, 2023
@rhettinger rhettinger self-assigned this Aug 22, 2023
@AlexWaygood AlexWaygood changed the title Speed-up NormalDist.samples() Speed-up statistics.NormalDist.samples() Aug 22, 2023
gpshead added a commit to gpshead/cpython that referenced this issue Aug 29, 2023
…les()`

python#108324 switched to a faster
implementation, but a caveat is that it changes the specific outputs.

This preserves backwards compatibility when the user has asked for
specific outputs by supplying a seed value.  With an option for them
to ask for the new algorithm implementation if desired.

When return random values anyway (no seed), the new faster algorithm is
used by default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 new features, bugs and security fixes performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

1 participant