On Mon, 29 Jun 2015 at 14:44 Oscar Benjamin <oscar.j.benja...@gmail.com>
wrote:

With your code (although I didn't import io.open) I found the timings:
> CPython 2.7: 1.4s
> PyPy 2.7: 2.3s
>
> I changed it to
> for line in f: # (not f.readlines())
>     a += len(line)
>
> With that change I get:
> CPython 2.7: 1.3s
> PyPy 2.7: 0.6s
>
>
Note that all of the timings above are "warm cache". That means that the
file was already cached in memory by the operating system because I had
recently read/written it. The time taken to load the file cold cache (e.g.
after rebooting) would probably be much longer in all cases so that the
difference between PyPy and CPython would not be significant. The problem
you've posted should really be IO bound which isn't really the kind of
situation where PyPy gains you much speed over CPython.

--
Oscar
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to