[Stackless] Stackless and simulation

sdfrost at UCSD.Edu sdfrost at UCSD.Edu
Sat Apr 19 20:38:41 CEST 2003

Dear Chris,

> In the example you gave, I have a simple improvement to suggest:
> The only action that you want to do on an IndexError is breaking
> the loop. In that context, you can save the overhead of creating
> a new exception handler all the time. A single one does it,
> under the assumption that cameContact() doesn't raise IndexError,
> itself:

Thanks for spotting that.

> Using tasklets or generators can save you something if you need
> lots of local state of your individuals, for instance.
> Tasklets have the benefit over generators, that you are not
> restricted to a single frame, but you can switch them at any
> recursion level. Using channels to communicate can give you
> some speed-up, if its built-in blocking mechanism is of
> advantage and saves you some code.
> In the example you gave, I don't see much improvements by using
> either. Maybe someone else has a better clue.

Ultimately, I will have lots of local state information, and blocking via 
channels would be nice and handy in terms of keeping the underlying code short.

Best wishes

More information about the Stackless mailing list