Re: [pypy-dev] pypy1.6 slow on string-heavy ops

2011-08-24 Thread Armin Rigo
Hi, On Tue, Aug 23, 2011 at 7:28 PM, Yury Selivanov yselivanov...@gmail.com wrote: If you read that Armin's email carefully, you notice that he talks about a low-level primitive called stacklets, which have some limitations, but are not intended for a regular use.  Greenlets will be

Re: [pypy-dev] pypy1.6 slow on string-heavy ops

2011-08-23 Thread Yury Selivanov
that? Thanks. From: Andy angelf...@yahoo.com To: Armin Rigo ar...@tunes.org Cc: pypy-dev@python.org pypy-dev@python.org Sent: Sunday, August 21, 2011 2:31 AM Subject: Re: [pypy-dev] pypy1.6 slow on string-heavy ops Thanks Armin. I dug around and found an email from you titled Stacklets

Re: [pypy-dev] pypy1.6 slow on string-heavy ops

2011-08-20 Thread Armin Rigo
Hi Andy, On Fri, Aug 19, 2011 at 5:48 PM, Andy angelf...@yahoo.com wrote: I remember reading in this list that PyPy-JIT would not work with greenlet because of how greentlet manipulated the C stack and there wasn't any easy solution. No, I think you are confusing two topics. The existing

Re: [pypy-dev] pypy1.6 slow on string-heavy ops

2011-08-19 Thread Armin Rigo
Hi Jacob, On Fri, Aug 19, 2011 at 2:10 AM, Jacob Biesinger jake.biesin...@gmail.com wrote: A bit OT:  The recent release of ipython added some powerful multiprocessing features using ZeroMQ.  I've only glanced at pypy's extensive threading optimizations (e.g., greenlets).  Does pypy jit across

Re: [pypy-dev] pypy1.6 slow on string-heavy ops

2011-08-18 Thread Justin Peel
Yes, Vincent's way is the better way to go. To elaborate more on the problem, string appending is O(N^2) while appending to a list and then joining is an O(N) operation. Why CPython is faster than Pypy at doing the less efficient way is something that I'm not fully sure about, but I believe that

Re: [pypy-dev] pypy1.6 slow on string-heavy ops

2011-08-18 Thread Aaron DeVore
Python 2.4 introduced a change that helps improve performance of string concatenation, according to its release notes. I don't know anything beyond that. -Aaron DeVore On Thu, Aug 18, 2011 at 3:31 PM, Justin Peel pee...@gmail.com wrote: Yes, Vincent's way is the better way to go. To elaborate

Re: [pypy-dev] pypy1.6 slow on string-heavy ops

2011-08-18 Thread Justin Peel
Yes, I just looked at it. For cases like this where there is effectively only one reference to the string being appended to, it just resizes the string in-place and copies in the string being appended which gives it O(N) performance. It is a hack that is available only because of the reference

Re: [pypy-dev] pypy1.6 slow on string-heavy ops

2011-08-18 Thread Jacob Biesinger
Wow thanks for the quick response. The performance is *much, much* better with the suggested list-join. CPython still beats Pypy, but only by a narrow margin: pypy1.6: 1m33.142s CPython 2.7.1: 1m12.092s Thanks for the advice-- I had forgotten about string immutability and its