[Python-Dev] nested scopes confusion

Thomas Heller thomas.heller@ion-tof.com
Tue, 4 Dec 2001 22:04:31 +0100

From: "Jeremy Hylton" <jeremy@zope.com>
> >>>>> "TH" == Thomas Heller <thomas.heller@ion-tof.com> writes:
>   >> But the performance characteristics of class vs. function is
>   >> really the bottleneck of your application?  Are you sure that
>   >> nested fuctions are really cheaper?
>   TH> Calling a.test() takes 3.3 microseconds, and c.test() takes 3.16
>   TH> microseconds.
> So I 5% difference, based on a single set of measurements with one
> compiler/platform/etc., is enough to go out of your way to avoid
> classes?
No. The test only shows (or suggests for this particular compiler/platform)
that calling methods (which are using nested scopes) has the same
speed than normal methods and not a factor of 5 or whatever
slowdown of callable classes.

>   That seems conceivable for some very small set of
> applications, but not in general.