On 18/02/13 21:15, Amaury Forgeot d'Arc wrote:
2013/2/18 Alex Gaynor <alex.gay...@gmail.com <mailto:alex.gay...@gmail.com>>

    So, iter(file).next() is slow?


Yes, but only with "rU" mode.
My benchmark with yesterday's build:

$ ~/pypy/pypy-c-jit-60005-0f1e91da6cb2-linux64/bin/pypy -m timeit "fp =
open('/tmp/large-text-file'); list(fp)"
10 loops, best of 3: 43.5 msec per loop
$ ~/pypy/pypy-c-jit-60005-0f1e91da6cb2-linux64/bin/pypy -m timeit "fp =
open('/tmp/large-text-file', 'rU'); list(fp)"
10 loops, best of 3: 638 msec per loop

15 times slower...


Yes you are right. We rerun the query without the 'rU' and the result is:

CPython: 328 msec
PyPy: 443 msec
PyPy (with 'rU'): 1 min 17 sec


So the main culprit of PyPy's slowdown is 'rU' option in open.

Thanks for looking into it.

l.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to