Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-20 Thread David Fraser
On Wednesday, July 20, 2011, at 8:50:20 AM, Alexander Petrov alexandervpet...@gmail.com wrote: [snip] So at this time I didn't come to some kind of decision about PyPy. On one hand in most of the cases with straitforward code/algorithms and common syntax constructs there was significant

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-20 Thread Carl Friedrich Bolz
On 07/20/2011 08:50 AM, Alexander Petrov wrote: So at this time I didn't come to some kind of decision about PyPy. On one hand in most of the cases with straitforward code/algorithms and common syntax constructs there was significant speed improvement. But on the other hand, for the cases

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-20 Thread David Fraser
On Wednesday, July 20, 2011 at 10:27:24 AM, Maciej Fijalkowski fij...@gmail.com wrote: On Wed, Jul 20, 2011 at 9:25 AM, David Fraser dav...@sjsoft.com wrote: On Wednesday, July 20, 2011, at 8:50:20 AM, Alexander Petrov alexandervpet...@gmail.com wrote: [snip] So at this time I

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-08 Thread Armin Rigo
Hi Alex, Before attacking the problem with the JIT, we should understand better why PyPy is 4-8 times slower than CPython. Normally you'd expect the factor to be at most 2. I suppose the answer is that our itertools.repeat() is bad for some reason. A bientôt, Armin.

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-08 Thread Stefan Behnel
Armin Rigo, 08.07.2011 11:18: Before attacking the problem with the JIT, we should understand better why PyPy is 4-8 times slower than CPython. Normally you'd expect the factor to be at most 2. I suppose the answer is that our itertools.repeat() is bad for some reason. You shouldn't forget

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-08 Thread Alex Gaynor
I'm not too sure what could be better wrong with it, it's rather short: https://bitbucket.org/pypy/pypy/src/default/pypy/module/itertools/interp_itertools.py#cl-85 Alex On Fri, Jul 8, 2011 at 2:18 AM, Armin Rigo ar...@tunes.org wrote: Hi Alex, Before attacking the problem with the JIT, we

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-07 Thread Alex Gaynor
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.

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-07 Thread Romain Guillebert
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,

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-07 Thread Alex Gaynor
repeat itself is not slow, it's just that when it's used it iterates over it, in RPython (meaning it's not jit'd) which results in a dictionary lookup for the next() method at every iteration, which is slowish, list hits a special case so it doesn' thave that overhead. Alex On Thu, Jul 7, 2011

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-07 Thread exarkun
On 12:38 am, alex.gay...@gmail.com wrote: repeat itself is not slow, it's just that when it's used it iterates over it, in RPython (meaning it's not jit'd) which results in a dictionary lookup for the next() method at every iteration, which is slowish, list hits a special case so it doesn'

Re: [pypy-dev] PyPy is much slower than CPython example / question

2011-07-07 Thread Alex Gaynor
No, you would need to implement list.__setitem__ in Python, which we could do, does the JIT see such code? Alex On Thu, Jul 7, 2011 at 6:05 PM, exar...@twistedmatrix.com wrote: On 12:38 am, alex.gay...@gmail.com wrote: repeat itself is not slow, it's just that when it's used it iterates over