On Thu, Jul 7, 2011 at 4:03 PM, Alexander Petrov <alexandervpet...@gmail.com > 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 > I haven't dug into this too deeply to see where the slowness is, however if you replace the setslice + repeat thingy with `for i in range(--that expression--): primes[i] = False` it becomes significantly faster, PyPy is 10x faster, and ~2x faster the original CPython version (CPython is ~2x slower when it's written this way). Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero
_______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev