[pypy-dev] PyPy 2x slower using cpickle

Eleytherios Stamatogiannakis estama at gmail.com
Tue Jul 9 17:29:01 CEST 2013


On 09/07/13 01:41, Antonio Cuni wrote:
> 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

The times that we got with improve-str2charp, are a little worse than 
the previous nightly build that i had tried with in my previous email. I 
have rerun the benchmark and the times (best of 3 runs) are:

CPython 2.7.3:              14.173 sec
PyPy nightly 3/7/2013: 32.105 sec
PyPy improve-str2charp: 34.044 sec

Regards,

l.


More information about the pypy-dev mailing list