Stackless in PyPy and PyPy + greenlet - differences

5.3k views Asked by At

New version of PyPy ships with integrated Stackless. As far as I know the bundled Stackless is not the same as the origin Stackless from 2001 with continuations. So mainly it is the green threads framework with dispatcher.

Greenlet is a spin-of Stackless which provides the Stackless green threads functionality as an extension module.

Is there any benefit from using "native" Stackless from PyPy than PyPy + greenlet + some dispatcher (eg: gevent)? Or the problem is that i can't use those types of extensions with PyPy? To be more specific: I know that PyPy has own implementation of greenlet (based on continulet). But I'm curious of the possibility of linking external greenlet with gevent and internal one in PyPy.

Does PyPy ships with an asynchronous IO library for Stackless to be used instead of standard one?

I know the stackless itself and other asynchronous light threads extensions to python (eventlet, gevent, twisted...). So i'm not looking the differences between them, rather advantages which comes form pypy with build in stackless.

1

There are 1 answers

0
amirouche On BEST ANSWER

Does PyPy ships with an asynchronous IO library for Stackless to be used instead of standard one?

As of PyPy 2.6.1 and PyPy3 2.4.0 you can use asyncio (via the pypi package) to replace the asynchronous features of stackless.

Is there any benefit from using "native" Stackless from PyPy than PyPy + greenlet + some dispatcher

Outside the richer Stackless API (e.g. pickling of micro-threads) it can be speed since the scheduler is part of the runtime written in C. Benchmarks should make this obvious or not.

For more informations on stackless, have a lookt at this article What is Stackless?