[Twisted-Python] Need some pointers for writing asynchronous code for Twisted app

Justin Warren daedalus at eigenmagic.com
Sat Mar 10 00:48:45 EST 2007

On Sat, 2007-03-10 at 12:02 +1100, Andrew Bennetts wrote:

> Finally, are you sure you really need to chunk this processing at all?
> ElementTree is pretty fast; it's entirely possible that breaking it into chunks
> and going in-and-out of the event loop repeatedly will hurt your performance
> more than just doing it all at once.  It might be a good idea to check if you
> actually have a real performance problem (rather than just a theoretical one)
> before you worry about solving it.

I agree. Premature optimisation is the root of all evil. I've done some
really dumb things trying to optimise too early, though I thought I was
being really clever at the time. If you're not sure how you're going to
do things, write a prototype first, then rewrite from scratch using
everything you learn from the prototype. You end up with better code in
the end, and it's faster and easier than trying to gradually migrate
old, poorly written code, in my experience.

Justin Warren <daedalus at eigenmagic.com>

More information about the Twisted-Python mailing list