[pypy-dev] Extension Modules Re: Question on Hard Switching and Soft Switching
Armin Rigo
arigo at tunes.org
Sun Oct 4 13:42:42 CEST 2009
Hi Andrew,
On Sat, Oct 03, 2009 at 03:37:10PM -0700, Andrew Francis wrote:
> But is soft switching still about roughly 10 times faster than hard
> switching (value quoted in the Nuts and Bolts presentation).
I don't know Stackless Python enough to tell you if this is still the
case, but I assume so.
> Because of only support for soft switching, I will assume I will have
> to write my own PyPy extension for say, networking I/O like
> select()/asyncore. Or does that already exist?
Indeed, any blocking system call will block all tasklets in PyPy. (I
don't think it has anything to do with soft- vs hard-switching; it is
the same in Stackless Python as far as I know.)
In general we didn't do much work to improve the situation -- it's a
matter of priorities: we chose to focus on issues like good garbage
collection and the just-in-time compiler generator, and mostly left
Stackless aside. I fear that we don't want to spend much time improving
Stackless support right now, but you are welcome to try and contribute
e.g. a modification to the '_select' module to optionally use,
internally, non-blocking sockets and be Stackless-aware in a
user-transparent manner. (Such a module can even be written in plain
Python and be portable across Stackless Python and Stackless PyPy. It
might even already have been written for Stackless Python; you should
look around.)
A bientot,
Armin.
More information about the Pypy-dev
mailing list