[Stackless] question about performance while running the actor example in "Introduction to Concurrent Programming with Stackless Python"

Richard Tew richard.m.tew at gmail.com
Wed Nov 11 00:20:12 CET 2009


On Wed, Nov 11, 2009 at 7:14 AM, Cui Jian <ken at informatik.uni-bremen.de> wrote:
> Or did I do something wrong by modifying the codes (even if I only deleted
> the displaying parts)?
> Or does this example itself lack of optimization, and doesn't reveal all the
> power of stackless...?

I would expect the example is intended to illustrate the use of
Stackless features for a contrived situation, not serve as an
optimised final solution to serve as how a game should be done.

I have no idea where 46 comes from or what it means, or why this
example as a whole appears to you to be slow.  But you could try
removing the mid-execution print statements, and instead printing out
a final summary.  You could try looking at how the scheduler is run
and how channel operations are engaged.  For instance, you can set a
channel to not block the sender, instead awakening the receiver as a
subsequently scheduled tasklet.  You could then switch some of the
.keys calls for .iterkeys, which would remove unnecessary copying.
Etc.

By the way, if anyone is going to post code to the mailing list,
please do it as an attachment.  Code pasted inline to the body of
mails tends to get distorted and is not guaranteed to work for anyone
who might copy and paste it out.

Cheers,
Richard.




More information about the Stackless mailing list