[pypy-dev] List Slicing Performance Drop

Antonio Cuni anto.cuni at gmail.com
Tue May 31 10:07:08 CEST 2011


On 31/05/11 09:13, Maciej Fijalkowski wrote:
> Anto: what version of python did you use? There can be 2.6 vs 2.7 issue

please don't do top posting, it's very confusing on mailing lists :-(

Anyway, the results below are with python2.7. python2.6 is slightly slower,
but not much. I confirm that pypy is faster on my machine.

ciao,
Anto

> On Mon, May 23, 2011 at 10:11 AM, Antonio Cuni <anto.cuni at gmail.com> wrote:
>> On 20/05/11 23:23, Mohyiddeen Othman wrote:
>>> Hi,
>>>
>>> I've been recently doing Project Euler puzzles using Python, and have recently
>>> started to use PyPy to increase performance. However I've come across
>>> something (no pun intended) puzzling. I made this script for Euler #50.
>>>
>>> http://pastebin.com/VZ12Nsci
>>>
>>> It calculates all the primes under 1M first, then looks through them for a
>>> solution. The first part (finding primes) is blazing fast under PyPy (as
>>> expected). But in the second part PyPy lags behind. CPython managed it in
>>> 183s, while PyPy did it in 498s. I'm assuming it has something to do with the
>>> list slicing?
>>
>> I cannot reproduce, for me pypy is faster on both pieces of code:
>>
>> viper ~ $ pypy-c /tmp/euler.py
>> ('All primes below', 1000000, 'found')
>> 0.43
>> Max sequence is:
>> ....
>> ....
>> ('It contains', 543, 'elements')
>> ('The sum is', 997651)
>> 72.61
>>
>>
>> viper ~ $ python /tmp/euler.py
>> ('All primes below', 1000000, 'found')
>> 4.58
>> Max sequence is:
>> ....
>> ....
>> ('It contains', 543, 'elements')
>> ('The sum is', 997651)
>> 128.81
>>
>>
>> Could you tell us more about your environment, like which OS, cpu, 32/64 bit
>> and the exact version of pypy/cpython you used to do the benchmark please?
>>
>> ciao,
>> Anto
>> _______________________________________________
>> pypy-dev mailing list
>> pypy-dev at python.org
>> http://mail.python.org/mailman/listinfo/pypy-dev
>>



More information about the pypy-dev mailing list