<p>What if you broke up the read and built the final string object up. I always assumed this is where the real gain was with read_into.</p>
<div class="gmail_quote">On Nov 25, 2011 5:55 AM, &quot;Eli Bendersky&quot; &lt;<a href="mailto:eliben@gmail.com">eliben@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_quote">On Thu, Nov 24, 2011 at 20:29, Antoine Pitrou <span dir="ltr">&lt;<a href="mailto:solipsis@pitrou.net" target="_blank">solipsis@pitrou.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>On Thu, 24 Nov 2011 20:15:25 +0200<br>
Eli Bendersky &lt;<a href="mailto:eliben@gmail.com" target="_blank">eliben@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Oops, readinto takes the same time as copying. This is a real shame,<br>
&gt; because readinto in conjunction with the buffer interface was supposed to<br>
&gt; avoid the redundant copy.<br>
&gt;<br>
&gt; Is there a real performance regression here, is this a well-known issue, or<br>
&gt; am I just missing something obvious?<br>
<br>
</div>Can you try with latest 3.3 (from the default branch)?<br></blockquote></div><br>Sure. Updated the default branch just now and built:<br><br>$1 -m timeit -s&#39;import fileread_bytearray&#39; &#39;fileread_bytearray.justread()&#39;<br>


1000 loops, best of 3: 1.14 msec per loop<br>$1 -m timeit -s&#39;import fileread_bytearray&#39; &#39;fileread_bytearray.readandcopy()&#39;<br>100 loops, best of 3: 2.78 msec per loop<br>$1 -m timeit -s&#39;import fileread_bytearray&#39; &#39;fileread_bytearray.readinto()&#39;<br>


1000 loops, best of 3: 1.6 msec per loop<br><br>Strange. Although here, like in python 2, the performance of readinto is close to justread and much faster than readandcopy, but justread itself is much slower than in 2.7 and 3.2!<br>


<br>Eli<br><br></div>
<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/anacrolix%40gmail.com" target="_blank">http://mail.python.org/mailman/options/python-dev/anacrolix%40gmail.com</a><br>
<br></blockquote></div>