Message266206
@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). |
|
Date |
User |
Action |
Args |
2016-05-23 23:21:41 | ideasman42 | set | recipients:
+ ideasman42, rhettinger, r.david.murray |
2016-05-23 23:21:41 | ideasman42 | set | messageid: <1464045701.04.0.698058921246.issue27096@psf.upfronthosting.co.za> |
2016-05-23 23:21:41 | ideasman42 | link | issue27096 messages |
2016-05-23 23:21:40 | ideasman42 | create | |
|