[pypy-dev] List Slicing Performance Drop
Antonio Cuni
anto.cuni at gmail.com
Mon May 23 10:11:35 CEST 2011
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
More information about the pypy-dev
mailing list