Message77814
Simply bumping TextIOWrapper._CHUNK_SIZE from 128 to 1024 yields some
significant performance improvements.
./python -m timeit -s "f=open('LICENSE')" "f.seek(0)" "for line in f: pass"
-> with 128: 6.21 msec per loop
-> with 1024: 3.41 msec per loop
./python -m timeit -s "f=open('LICENSE')" "f.seek(0)" "while
f.read(100): pass"
-> with 128: 4.03 msec per loop
-> with 1024: 1.25 msec per loop
Is there any counter-indication to doing so? |
|
Date |
User |
Action |
Args |
2008-12-14 18:18:31 | pitrou | set | recipients:
+ pitrou, christian.heimes |
2008-12-14 18:18:30 | pitrou | set | messageid: <1229278711.0.0.240635346547.issue4663@psf.upfronthosting.co.za> |
2008-12-14 18:18:30 | pitrou | link | issue4663 messages |
2008-12-14 18:18:29 | pitrou | create | |
|