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 ideasman42
Recipients ideasman42, r.david.murray, rhettinger
Date 2016-05-23.23:21:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464045701.04.0.698058921246.issue27096@psf.upfronthosting.co.za>
In-reply-to
Content
@r.david.murray, yes, this avoids list creation, but is still quite slow.

To create 1mb of data, you can compare the following:

    python -m timeit -s 'from os import urandom' 'print(len(urandom(1000000)))'

    python -m timeit -s 'from random import randint' 'print(len(bytes(randint(0, 255) for i in range(1000000))))'

On my system `os.urandom` is 0.04sec, using randint takes 2.24sec (approx 50x slower).
History
Date User Action Args
2016-05-23 23:21:41ideasman42setrecipients: + ideasman42, rhettinger, r.david.murray
2016-05-23 23:21:41ideasman42setmessageid: <1464045701.04.0.698058921246.issue27096@psf.upfronthosting.co.za>
2016-05-23 23:21:41ideasman42linkissue27096 messages
2016-05-23 23:21:40ideasman42create