[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pypy-dev
Subject:    Re: [pypy-dev] PyPy is much slower than CPython example / question
From:       Alex Gaynor <alex.gaynor () gmail ! com>
Date:       2011-07-08 0:12:59
Message-ID: CAFRnB2VPGDOWRHq9CCyGRH-tLEj+R1S3PWtTewhvvbfsHdeGdw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Thu, Jul 7, 2011 at 4:03 PM, Alexander Petrov <alexandervpetrov@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

[Attachment #5 (text/html)]

<br><br><div class="gmail_quote">On Thu, Jul 7, 2011 at 4:03 PM, Alexander Petrov \
<span dir="ltr">&lt;<a \
href="mailto:alexandervpetrov@gmail.com">alexandervpetrov@gmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex;"> Hi.<br>
<br>
I&#39;m new to PyPy and was trying to run some tests to see orders of<br>
speed improvement.<br>
<br>
Short script generating list of prime numbers using rather<br>
straightforward implementation of Eratosthene&#39;s sieve.<br>
Script: <a href="http://paste.pocoo.org/show/432727/" \
target="_blank">http://paste.pocoo.org/show/432727/</a><br> <br>
Typical results: <a href="http://paste.pocoo.org/show/432733/" \
target="_blank">http://paste.pocoo.org/show/432733/</a><br> (I thought that is due to \
absense of SSE2 on first computer, but I&#39;ve<br> rechecked on Intel(R) Xeon(R) CPU \
L5520 @ 2.27GHz with similar<br> results).<br>
<br>
I&#39;m getting that CPython is nearly 4-8 times faster than PyPy.<br>
Is it a bug in PyPy or what is wrong (may be &quot;specific&quot; to PyPy) in my \
script?<br> <br>
Alex.<br>
_______________________________________________<br>
pypy-dev mailing list<br>
<a href="mailto:pypy-dev@python.org">pypy-dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/pypy-dev" \
target="_blank">http://mail.python.org/mailman/listinfo/pypy-dev</a><br> \
</blockquote></div><br>I haven&#39;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&#39;s written this way).<div> <br></div><div>Alex<br clear="all"><br>-- \
<br>&quot;I disapprove of what you say, but I will defend to the death your right to \
say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>&quot;The \
people&#39;s good is the highest law.&quot; -- Cicero<br> <br>
</div>



_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic