[Patches] Patch: AttributeError and NameError: second attempt.

M.-A. Lemburg mal@lemburg.com
Fri, 26 May 2000 15:59:54 +0200


Nick Mathewson wrote:
> 
> Not that it matters any more, but I thought I'd answer this question.
> The reasoning is kind of neat.
> 
> "M.-A. Lemburg" <mal@lemburg.com> wrote:
>  [...]
> >>
> >> modified python:          22.790u 0.030s
> >
> >You mean CVS Python + your patch ? If yes, how can there be
> >a speedup of this amount ?
> >
> >> cvs python, unmodified:   32.920u 0.000s
> >> python 1.6a2:             39.850u 0.060s
> >> python 1.5.2:             33.380u 0.020s
> 
> Because we're only testing the time it takes to generate and throw the
> exception.  When you throw an AttributeError on an Object now, you
> need to generate a new string containing the Object's type and the
> missing attribute.  With my patch, even _this_ work was postponed until
> you printed the exception.

Nice optimization... (my applications throw a lot of AttributeErrors
and don't really care about the error string)

Perhaps something which should be enabled via the -OO switch ?
(-OO is reserved for optimizations which could potentially break
things.)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/