Message165937
Under Windows (64-bit Windows 7 on a VirtualBox VM), the patch increases performance slightly but not as much as under Linux:
-> before patch:
C:\t\cpython>pc\VS9.0\amd64\python.exe -m timeit -s "import io; n=2000; d=[b'a'*
n,b'bb'*n,b'ccc'*n]*1000" "s=io.BytesIO(); w=s.write" "for x in d: w(x)" "s.g
etvalue()"
10 loops, best of 3: 49.2 msec per loop
-> after patch:
C:\t\cpython>pc\VS9.0\amd64\python.exe -m timeit -s "import io; n=2000; d=[b'a'*
n,b'bb'*n,b'ccc'*n]*1000" "s=io.BytesIO(); w=s.write" "for x in d: w(x)" "s.g
etvalue()"
10 loops, best of 3: 41.7 msec per loop
And the join() approach is 10x faster (!):
C:\t\cpython>pc\VS9.0\amd64\python.exe -m timeit -s "import io; n=2000; d=[b'a'*
n,b'bb'*n,b'ccc'*n]*1000" "b''.join(d)"
100 loops, best of 3: 4.63 msec per loop
... which points to a much less optimized realloc() under Windows. |
|
Date |
User |
Action |
Args |
2012-07-20 15:16:09 | pitrou | set | recipients:
+ pitrou, ncoghlan, Arfrever, eli.bendersky, meador.inge, tshepang, jcon, serhiy.storchaka |
2012-07-20 15:16:09 | pitrou | set | messageid: <1342797369.38.0.267796087742.issue15381@psf.upfronthosting.co.za> |
2012-07-20 15:16:08 | pitrou | link | issue15381 messages |
2012-07-20 15:16:08 | pitrou | create | |
|