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 pitrou
Recipients Arfrever, eli.bendersky, jcon, meador.inge, ncoghlan, pitrou, serhiy.storchaka, tshepang
Date 2012-07-20.15:16:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342797369.38.0.267796087742.issue15381@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-07-20 15:16:09pitrousetrecipients: + pitrou, ncoghlan, Arfrever, eli.bendersky, meador.inge, tshepang, jcon, serhiy.storchaka
2012-07-20 15:16:09pitrousetmessageid: <1342797369.38.0.267796087742.issue15381@psf.upfronthosting.co.za>
2012-07-20 15:16:08pitroulinkissue15381 messages
2012-07-20 15:16:08pitroucreate