[Stackless] verify my performance numbers?

Max Noel maxfnoel at gmail.com
Sat Jan 27 00:16:48 CET 2007

On 26 Jan 2007, at 23:42, Andrew Dalke wrote:

>   I'm working on my presentation for PyCon.  I'm giving an
> intro to Stackless talk.  I'm about 1/2 way through my rough
> draft version -- text only, not in slide format, etc.  I compared
> using Stackless to using threads for the same task, which is
> to invert a callback solution (parsing XML using SAX) into an
> iterator solution.

Interesting idea, I hadn't thought of using Stackless to do that.

>   In doing the testing now I found (using best of 3):
> threaded version: 93 seconds (94.9s, 94.5s, 93.1s)
> stackless version: 20 seconds (20.8s, 19.9s, 20.4s)
> low-level SAX interface: 8.4 seconds  (8.36s, 8.57s, 8.49s)

All right, here are my results, running OS X 10.4.8 PPC (Dual 2GHz G5  
Power Mac) with Python 2.5 Stackless 3.1b3:

threaded: 37.7 seconds (37.7s, 38.3s, 38.5s)
stackless: 4.2 seconds (4.3s, 4.2s, 4.2s)
SAX: 2.1 seconds (2.1s, 2.1s, 2.1s)

I used my own iTunes library, which is weighs in at 2.9 megs.

> I'm happy, and a bit surprised, that the stackless vs.
> thread solutions are that big.  Would some here care
> to re-test my code and verify that for me?

It's not that surprising, seeing that the whole point of Stackless is  
to allow arbitrarily large numbers of microthreads with close to no  
overhead. The gap widens by several orders of magnitude as the number  
of threads/tasklets increases (until you hit your OS's limit and  
can't spawn any more threads whereas Stackless keeps working happily).

> I tested this on a Mac PowerBook G4 running 10.3 and would
> like to see number for other OSes/thread implementations.

This machine is a Mac too, albeit one with a different processor and  
version of OS X. Still, numbers for Linux, Windows and BSDs would be  
better. I expect they'll exhibit the same characteristics.

-- Max

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list