Author pitrou
Recipients Arfrever, eli.bendersky, jcon, meador.inge, ncoghlan, pitrou, serhiy.storchaka, tshepang
Date 2012-07-20.15:03:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342796608.8.0.788759810799.issue15381@psf.upfronthosting.co.za>
In-reply-to
Content
There seems to be a problem with the patch: when you store the getvalue() result somewhere (instead of discarding it), things get much slower:

$ ./python -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.getvalue()"
1000 loops, best of 3: 913 usec per loop

$ ./python -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)"  "global y; y = s.getvalue()"
100 loops, best of 3: 4.67 msec per loop

This does not happen without the patch.
History
Date User Action Args
2012-07-20 15:03:29pitrousetrecipients: + pitrou, ncoghlan, Arfrever, eli.bendersky, meador.inge, tshepang, jcon, serhiy.storchaka
2012-07-20 15:03:28pitrousetmessageid: <1342796608.8.0.788759810799.issue15381@psf.upfronthosting.co.za>
2012-07-20 15:03:28pitroulinkissue15381 messages
2012-07-20 15:03:27pitroucreate