homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, nadeem.vawda, pitrou, rhettinger
Date 2011年11月13日.21:14:57
SpamBayes Score 2.856632e-07
Marked as misclassified No
Message-id <1321218898.3.0.176661098379.issue13396@psf.upfronthosting.co.za>
In-reply-to
Content
./python -m timeit -s "from random import getrandbits" "getrandbits(8000000).to_bytes(1000000, 'little')"
10 loops, best of 3: 25 msec per loop
./python -m timeit -s "from random import getrandbytes" "getrandbytes(1000000)"
100 loops, best of 3: 9.66 msec per loop
For the Mersenne Twister, getrandbytes() is ~2.5 times faster (A length of 1000 gives exactly the same ratio)
When applied to the SytemRandom object, the difference is less impressive (probably because os.urandom is slow) but getrandbytes is still 20ms faster.
Updated patch to add getrandbytes at the module level, and to SystemRandom.
History
Date User Action Args
2011年11月13日 21:14:58amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, rhettinger, pitrou, nadeem.vawda
2011年11月13日 21:14:58amaury.forgeotdarcsetmessageid: <1321218898.3.0.176661098379.issue13396@psf.upfronthosting.co.za>
2011年11月13日 21:14:57amaury.forgeotdarclinkissue13396 messages
2011年11月13日 21:14:57amaury.forgeotdarccreate

AltStyle によって変換されたページ (->オリジナル) /