[Python-Dev] file.readinto performance regression in Python 3.2 vs. 2.7?

Matt Joiner anacrolix at gmail.com
Fri Nov 25 12:23:03 CET 2011


You can see in the tests on the largest buffer size tested, 8192, that
the naive "read" actually outperforms readinto(). It's possibly by
extrapolating into significantly larger buffer sizes that readinto()
gets left behind. It's also reasonable to assume that this wasn't
tested thoroughly.

On Fri, Nov 25, 2011 at 9:55 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Fri, 25 Nov 2011 08:38:48 +0200
> Eli Bendersky <eliben at gmail.com> wrote:
>>
>> 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
>>
>> Regarding the second, I'm not sure it'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
>>
>> However, the original question remains - on the 100MB file also, although
>> in 2.7 readinto is 35% faster than readandcopy(), on 3.2 it'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)?
>
> It would probably be http://hg.python.org/cpython/rev/a1d77c6f4ec1/
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/anacrolix%40gmail.com
>


More information about the Python-Dev mailing list