Message198415
Here is a patch. Benchmarks (under Linux where realloc is fast; the gap may be wider under Windows):
$ ./python -m timeit "b=bytearray(100000)" "while b: b[:1] = b''"
-> before: 225 msec per loop
-> after: 60.4 msec per loop
$ ./python -m timeit "b=bytearray(100000)" "while b: b[:200] = b''"
-> before: 1.17 msec per loop
-> after: 350 usec per loop |
|
Date |
User |
Action |
Args |
2013-09-25 20:26:02 | pitrou | set | recipients:
+ pitrou, vstinner, serhiy.storchaka |
2013-09-25 20:26:02 | pitrou | set | messageid: <1380140762.59.0.0778893115079.issue19087@psf.upfronthosting.co.za> |
2013-09-25 20:26:02 | pitrou | link | issue19087 messages |
2013-09-25 20:26:02 | pitrou | create | |
|