[Python-Dev] Re: PEP 282 comments
Jeremy Hylton
jeremy@zope.com
Thu, 21 Mar 2002 19:13:48 -0500
>>>>> "KB" == Kevin Butler <kbutler@campuspipeline.com> writes:
KB> [Jeremy]
>> Why do you need **kwargs at all?
KB> So we can postpone formatting the optional arguments into a
KB> message until after we test if we're going to log the message or
KB> not.
Aha! I must have gone out of my way to miss this. This is certainly
a good thing. In the case of the ZEO server, we put all the trace and
debug level logging calls inside "if __debug__:" We see a 20% speedup
on compute intensive benchmarks when running with -O. So avoiding the
string formatting is a nice savings.
On the other hand, extended calls -- where the caller passes *args or
**args -- are a lot slower than regular calls. It would be
interesting to benchmark both approaches. I expect that no-formatting
is faster, but wouldn't bet too much on it. Apps probably still
benefit from exploting if __debug__.
Jeremy