本文介绍了PyPy和PyPy + greenlet中的Stackless-差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新版本的PyPy带有集成的 Stackless .据我所知,捆绑的Stackless与2001年延续的原产Stackless不同.因此,主要是带有调度程序的绿色线程框架.

Greenlet 是Stackless的衍生产品,它提供了Stackless绿色线程功能作为扩展模块.

使用 PyPy 中的本机" Stackless 比使用 PyPy + greenlet +一些调度程序有什么好处(例如: gevent )?还是问题是我无法在PyPy中使用这些扩展名?更具体地说:我知道PyPy有自己的greenlet实现(基于 continulet ).但是我很好奇能否将外部Greenlet与gevent和内部PyPy中的内部事件链接.

PyPy是否随附用于Stackless的异步IO库,而不是标准库?

我知道无堆栈本身以及其他对python的异步轻线程扩展(eventlet,gevent,twisted ...).因此,我不是在看它们之间的差异,而是在无栈构建的pypy中带来的优势.

解决方案

PyPy是否提供了异步IO库以供Stackless使用,而不是标准库?

从PyPy 2.6.1和PyPy3 2.4.0开始,您可以使用 asyncio (通过pypi包)来替换无堆栈的异步功能.

从PyPy使用本机" Stackless是否比PyPy + greenlet +一些调度程序有什么好处

在更丰富的Stackless API(例如微线程的酸洗)之外,由于调度程序是用C语言编写的运行时的一部分,因此它可以提高速度.

有关Stackless的更多信息,请查看本文什么是Stackless ?

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.

解决方案

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?

这篇关于PyPy和PyPy + greenlet中的Stackless-差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 18:13