[pypy-issue] [issue1528] I/O in pypy is up to 2x slower than CPython

Lefteris Stamatogiannakis tracker at bugs.pypy.org
Thu Jul 4 12:16:25 CEST 2013


New submission from Lefteris Stamatogiannakis <estama at gmail.com>:

Reading a file in pypy can be up to ~2x slower than CPython.

Antonio Cuni mentioned that it may be a problem with the low level implementation of pypy:

On 4/7/2013 9:12 am, Antonio Cuni wrote:
"Few days ago I discovered that there is an easy optimization for this. If you look at how 
str2charp & friends are implemented, you see that we do an RPython loop and copy char by 
char.
By contrast, things like string concatenation are implemented using memcpy and are much 
faster (like 3-4 times, iirc)."

Example code:

f=open("text.txt", "w+b")
s="qwerty" * 10 + '\n'

for i in xrange(100000):
    f.write(s)

----------
messages: 5905
nosy: estama, pypy-issue
priority: performance bug
status: unread
title: I/O in pypy is up to 2x slower than CPython

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1528>
________________________________________


More information about the pypy-issue mailing list