<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Thu, 24 Nov 2011 20:53:30 +0200<br>
Eli Bendersky &lt;<a href="mailto:eliben@gmail.com">eliben@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Sure. Updated the default branch just now and built:<br>
&gt;<br>
&gt; $1 -m timeit -s&#39;import fileread_bytearray&#39; &#39;fileread_bytearray.justread()&#39;<br>
&gt; 1000 loops, best of 3: 1.14 msec per loop<br>
&gt; $1 -m timeit -s&#39;import fileread_bytearray&#39;<br>
&gt; &#39;fileread_bytearray.readandcopy()&#39;<br>
&gt; 100 loops, best of 3: 2.78 msec per loop<br>
&gt; $1 -m timeit -s&#39;import fileread_bytearray&#39; &#39;fileread_bytearray.readinto()&#39;<br>
&gt; 1000 loops, best of 3: 1.6 msec per loop<br>
&gt;<br>
&gt; Strange. Although here, like in python 2, the performance of readinto is<br>
&gt; close to justread and much faster than readandcopy, but justread itself is<br>
&gt; much slower than in 2.7 and 3.2!<br>
<br>
</div>This seems to be a side-effect of<br>
<a href="http://hg.python.org/cpython/rev/f8a697bc3ca8/" target="_blank">http://hg.python.org/cpython/rev/f8a697bc3ca8/</a><br>
<br>
Now I&#39;m not sure if these numbers matter a lot.  1.6ms for a 3.6MB file<br>
is still more than 2 GB/s.<br></blockquote></div><br>Just to be clear, there were two separate issues raised here. One is the speed regression of readinto() from 2.7 to 3.2, and the other is the relative slowness of justread() in 3.3<br>

<br>Regarding the second, I&#39;m not sure it&#39;s an issue because I tried a larger file (100MB and then also 300MB) and the speed of 3.3 is now on par with 3.2 and 2.7<br><br>However, the original question remains - on the 100MB file also, although in 2.7 readinto is 35% faster than readandcopy(), on 3.2 it&#39;s about the same speed (even a few % slower). That said, I now observe with Python 3.3 the same speed as with 2.7, including the readinto() speedup - so it appears that the readinto() regression has been solved in 3.3? Any clue about where it happened (i.e. which bug/changeset)?<br>

<br>Eli<br><br><br><br></div>