Stackless in PyPy and PyPy + greenlet - differences

爷,独闯天下 提交于 2019-12-31 10:43:23

问题


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:


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?



来源:https://stackoverflow.com/questions/8960747/stackless-in-pypy-and-pypy-greenlet-differences

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!