[Stackless] Stackless and simulation

sdfrost at UCSD.Edu sdfrost at UCSD.Edu
Sat Apr 19 17:51:53 CEST 2003


Dear Stackless list,

If I may, I'd like to ask a few questions relating to the use of Stackless in 
simulation. I'm trying to run some agent-based models, similar to that of 
Boudewijn Rempt (modified for Stackless 2 by Aaron Watters). I'm playing 
around with various implementations, including SimPy 
(http://simpy.sourceforge.net), that uses generators to implement lightweight 
threads a la David Mertz. I've also hacked up some simple models that don't 
use generators (see the example below).

Firstly, if I use tasklets to implement these models, will they be faster than 
using generator or non-generator based implementations?

Secondly, how would I modify my model to use tasklets rather than 
generators/function calls?

A brief description of the model. It's a simple epidemic, where susceptible 
individuals contact other individuals, and become infected with a certain 
probability when they contact an infected individual. I'm using bisect to 
store a sorted list of timestamps. It runs reasonably fast (especially if I 
use Psyco), and I'd be interested to see if I can squeeze any more performance 
out of it (although pickling the simulation, and load-balancing across 
multiple processors would also be nice).

Thanks!
Simon
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: epidemic.py
URL: <http://www.stackless.com/pipermail/stackless/attachments/20030419/436a2b9b/attachment.txt>


More information about the Stackless mailing list