[pypy-dev] PyPy 2x slower using cpickle

Antonio Cuni anto.cuni at gmail.com
Tue Jul 9 00:41:44 CEST 2013


Hello Eleytherios,

On 07/04/2013 08:12 AM, Antonio Cuni wrote:
>
> Il giorno 03/lug/2013 18:17, "Amaury Forgeot d'Arc" <amauryfa at gmail.com
> <mailto:amauryfa at gmail.com>> ha scritto:
>
>  > This is because of I/O.
>  > If I replace the file with a custom class which has an empty write() method,
>  > pypy is twice faster than CPython.
>
> 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).
> Sorry if I don't give more precise pointer, but I'm on my mobile phone :-)

could you try to rerun your benchmark on the improve-str2charp branch please?
The benchmarks on speed.pypy.org shows some important speedup in e.g. 
twisted_tcp or raytrace_simple, which seems to contain a lot of write I/O, so 
it might help your case as well:

http://speed.pypy.org/comparison/?exe=1%2BL%2Bdefault%2C1%2BL%2Bimprove-str2charp&ben=1%2C34%2C27%2C2%2C25%2C3%2C46%2C4%2C5%2C41%2C42%2C22%2C44%2C6%2C39%2C7%2C8%2C45%2C23%2C24%2C9%2C10%2C47%2C48%2C49%2C50%2C51%2C11%2C12%2C13%2C40%2C14%2C15%2C35%2C36%2C37%2C38%2C16%2C52%2C54%2C55%2C53%2C56%2C28%2C30%2C32%2C29%2C33%2C17%2C18%2C19%2C20%2C43&env=1&hor=true&bas=1%2BL%2Bdefault&chart=normal+bars

ciao,
Anto


More information about the pypy-dev mailing list