Author pitrou
Recipients dmalcolm, eli.bendersky, flox, kaifeng, neologix, pitrou, python-dev
Date 2011-11-25.12:52:55
SpamBayes Score 4.74389e-07
Marked as misclassified No
Message-id <1322225576.44.0.73701624914.issue11849@psf.upfronthosting.co.za>
In-reply-to
Content
Ah, sorry, false alarm. "b[:] = b" actually makes a temporary copy of the bytearray when assigning to itself (!).

However, there's still another strange regression:

$ ./python -m timeit \
  -s "n=300000; f=open('10MB.bin', 'rb', buffering=0); b=bytearray(n)" \
  "f.seek(0);f.readinto(b)"

-> default branch:
10000 loops, best of 3: 43 usec per loop
-> default branch with patch reverted:
10000 loops, best of 3: 27.5 usec per loop

FileIO.readinto executes a single read() into the passed buffer.
History
Date User Action Args
2011-11-25 12:52:56pitrousetrecipients: + pitrou, eli.bendersky, flox, dmalcolm, neologix, python-dev, kaifeng
2011-11-25 12:52:56pitrousetmessageid: <1322225576.44.0.73701624914.issue11849@psf.upfronthosting.co.za>
2011-11-25 12:52:55pitroulinkissue11849 messages
2011-11-25 12:52:55pitroucreate