[Python-Dev] ineffective optimization: method tables

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Tue, 24 Apr 2001 08:24:09 +0200


> Unfortunately, all my benchmarks show this patch to be ineffective
> in terms of speeding up the interpreter.  Anyone know why?

I guess because you took PyObject_IsTrue. After profiling some
application, I found that this is a frequent function, so I thought it
should be optimized.

I then found that most of the time, it gets Py_True, Py_False, or
Py_None as an argument, so I checked for identity with these objects.
Indeed, that covered the majority of the calls - but with no
significant speed gain when special-cased.

So I think I agree with Guido: even as these functions are frequently
called, this is not where the time is consumed.

Regards,
Martin