[melbourne-pug] stackless python question

Lars Yencken lljy at csse.unimelb.edu.au
Wed Apr 1 01:17:21 CEST 2009


2009/3/31 John Thorn <swifteye2 at msn.com>

>  What advantages does Stackless python have over normal python? If the
> concurrent programming of stackless python IS faster, then why wasn't python
> stackless in the first place? Or is there some downside to stackless python
> that complicates the issue?
>

Here's my basic understanding, not having used Stackless.

Some types of application are best served by a highly threaded programming.
Threads are managed by the OS, and thus have overhead associated with
creating them and switching between them. Stackless is designed to solve
these types of problems more elegantly and with better performance than
CPython.

In stackless python they have lightweight versions of threads (Tasklets?)
which are part of the python interpreter. Since they aren't managed by the
OS, there isn't large overhead in creating them or switching between them.

I'm guessing there's some single-threaded overhead that you pay for using
stackless though, which is the main reason their changes haven't merged into
the main CPython codebase. Because they're maintaining a fork, they're also
lagging behind the main project; for example versions of stackless for
python 2.6 and 3.0 are still labeled unreliable by the stackless team.

Basically, if you don't need a lot of concurrency, CPython will give you
better performance. If you do need a lot of concurrency, Stackless will
perform better, and provide better tools for managing that concurrency so
that you're more productive.

Cheers,
Lars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/melbourne-pug/attachments/20090401/e48f3522/attachment.htm>


More information about the melbourne-pug mailing list