Hi When I change this line:
primes[i*i:N+1:i] = repeat(False, len(primes[i*i:N+1:i])) into this : primes[i*i:N+1:i] = [False] * len(primes[i*i:N+1:i]) PyPy is much faster (but is still slower than CPython), so I would guess that the repeat function is the one to blame. Cheers Romain On Fri, Jul 08, 2011 at 02:03:20AM +0300, Alexander Petrov wrote: > Hi. > > I'm new to PyPy and was trying to run some tests to see orders of > speed improvement. > > Short script generating list of prime numbers using rather > straightforward implementation of Eratosthene's sieve. > Script: http://paste.pocoo.org/show/432727/ > > Typical results: http://paste.pocoo.org/show/432733/ > (I thought that is due to absense of SSE2 on first computer, but I've > rechecked on Intel(R) Xeon(R) CPU L5520 @ 2.27GHz with similar > results). > > I'm getting that CPython is nearly 4-8 times faster than PyPy. > Is it a bug in PyPy or what is wrong (may be "specific" to PyPy) in my script? > > Alex. > _______________________________________________ > pypy-dev mailing list > pypy-dev@python.org > http://mail.python.org/mailman/listinfo/pypy-dev _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev