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

ENH: replace GIL of random module with a per state lock #4609

Merged
merged 1 commit into from May 4, 2014

Commits on May 2, 2014

  1. ENH: replace GIL of random module with a per state lock

    The random module currently relies on the GIL for the state
    synchronization which hampers threading performance.
    Instead add a lock to the RandomState object and take it for all
    operations calling into randomkit while releasing the GIL.
    This allows parallizing random number generation using multiple states
    or asynchronous generation in a worker thread.
    
    Note that with a large number of threads the standard mersenne twister
    used may exhibit overlap if the number of parallel streams is large
    compared to the size of the state space, though due to the limited
    scalability of Python in regards to threads this is likely not a big
    issue.
    juliantaylor committed May 2, 2014
    3
    Copy the full SHA
    94172e1 View commit details
    Browse the repository at this point in the history