[Twisted-Python] inlineCallbacks vs explicit callbacks: performance concerns?

Glyph Lefkowitz glyph at twistedmatrix.com
Sun May 9 23:29:31 MDT 2010


On May 9, 2010, at 11:16 PM, Paul Goins wrote:

> Question: Is there a performance related reason why Twisted core does not use inlineCallbacks?

Twisted itself (all parts of Twisted, not just Twisted core) does not use inlineCallbacks because it requires syntax only available Python 2.5, and Twisted still supports Python 2.4.

inlineCallbacks does have some overhead, but in the contexts where it's most helpful (sequential tasks where you want to have limited parallelism and lots of asynchronous things happening) that *should* be negligible compared to regular Deferreds.  The place it really starts to bite you is if you just make every method @inlineCallbacks; in that case, not only are you spending a lot of extra time in Deferred methods, you're probably sequentializing a lot of potentially concurrent I/O.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20100510/a37f965c/attachment-0001.html>


More information about the Twisted-Python mailing list