[Stackless] Planning Stackless Lite

Christian Tismer tismer at stackless.com
Wed Feb 3 02:28:55 CET 2010

On 2/2/10 6:53 PM, Andrew Francis wrote:
> Hi Richard:
>> This sounds a bit strange to me.  What maintenance are greenlets not
>> getting?
> I believe Greenlets are at version 0.2 and I don't think they have been worked on for a while. This probably does not have any significance to Stackless Python but it may have a significance to PyPy.
> To the best of my knowledge, PyPy supports soft switching only. However
> greenlets use hard switching and stackless.py is built on top of greenlets. I don't know if this means there is room for improvement in the PyPy world in this regard.
This sounds strange without some commentary:

PyPy supports soft switching only. This is not a deficiency,
but a virtue.

This soft switching is possible since PyPy has full control over
itself. And in this context, things like Greenlets do not exist.
Yes, as an application on top, but that is unrelated.

For this soft switching to work, the underlying system must be
able to do stack unwinding. When PyPy is translated to C, this
is implemented by all the transformations of flow graphs into
C routines.

What you are referring to, and that is a unification that I cannot
leave leave as is, is the case when PyPy runs on top of a Python
interpreter. The Python interpreter must then emulate soft
switching, for testing purposes. Exactly for that case using
the greenlets for emulation came in handy, just as a surrogate.

But this use case of Greenlets has nothing at all to do with PyPy and
does not belong to the PyPy world. It is an implementation detail
for a feature that seemed impossible to emulate for PyPy on top
of Python, but it works great.

The alternative would have been to be unable to perform certain
tests in PyPy on Python. It would have required compilation,
all the time.

But to pull this fact apart as an argument into any direction is
totally inappropriate.
>> The advantage they  have over Stackless, is that they are an
>> extension that does not need to be maintained.  The only work they
>> require is additional assembler files for additional platforms.
> Another advantage is that greenlets are good for prototyping. As per Carl
> Bolz and Stephan Diehl's advice, I use greenlets in conjunction with stackless.py and Standard Python to experiment with new features (i.e., select - soon to become event handlers).
These advantages will now end up in Stackless, something that I
should have done ten years earlier.
Worst thing that can happen is the same solution as with Greenlets.
With a bit of luck, most hard switching can be turned into soft,
and that will make a difference, concerning performance and pickling.

sorry about my tone -- sincerely - chris

Christian Tismer             :^)<mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key ->  http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/

More information about the Stackless mailing list