[Twisted-Python] Failure is O(state) vs Exception
Andrew Bennetts
andrew at bemusement.org
Thu Mar 31 00:41:08 EDT 2011
Glyph Lefkowitz wrote:
[…]
> Agreed. I've seen this behavior crop up shocking close to the top of profiles
> for Calendar Server as well, so I'm very glad to hear you've undertaken this
> work. The current default is almost certainly wrong; the only code which has
> practically ever used it was the HTML traceback stuff, which most serious
> users disable for security reasons anyway.
Good to know we're not the only ones :)
The fact that it speeds up 'trial twisted' by ~10-15% is a nice bonus too!
> Debugging is kind of a process-global thing, most of the time. I think maybe
> we should have 'twisted.python.debug' which is the main thing that all these
> features use, and then a setDebugging for each system (Failure, Deferred,
> reactor; and ideally, eventually stuff like web, mail, conch too) to turn on
> these expensive-but-occasionally-worthwhile features.
A similar scheme has worked well for bzrlib. +1
> But I'd be happy if this change did _nothing_ but make Failure simply default
> to not capturing globals and locals, and add a flag to explicitly request this
> behavior. Like you say: the information is always captured but almost never
> used.
That's fine with me! I'll update the patch to add captureVars=False to
Failure.__init__ instead of what it currently does, and happily leave defer.py
unmodified from trunk.
Thanks for the feedback,
-Andrew.
More information about the Twisted-Python
mailing list