[Python-Dev] CALL_ATTR patch (was: 2.3b1 release)

Thomas Wouters thomas@xs4all.net
Sat, 19 Apr 2003 00:50:55 +0200


On Fri, Apr 18, 2003 at 02:34:31AM +0200, Thomas Wouters wrote:
> On Fri, Apr 18, 2003 at 02:06:50AM +0200, Thomas Wouters wrote:

> > Hm, wait, handling PyMethodDescrs may not be as tricky as I thought...
> > hrm... I'll look at it tomorrow, it's time for bed.

> I did a quick hack to the same effect, and it still came out a 1% loss (so
> about 6% against the no-newstyle patch) in PyBench and a few timeit tests.
> Sigh. I guess the non-method overhead is just too large, or there are more
> almost-methods than I figured. I'll start work on a more lookup-saving
> _PyObject_Generic_getmethod tomorrow or this weekend (and will probably do
> _Py_instance_getmethod that way too, while I'm at it.)

Okay, for those who care about this but aren't on Patches, I just uploaded a
new CALL_ATTR patch, version 4. It's actually two separate versions (3 and
4): maintainable, and fast. See the SF patch comment for more details :)

However, I spent most of tonight trying to clock the patch, only to come to
the conclusion that benchmarks suck. Which I already knew :) PyBench did a
reasonable job pointing me towards slowness, but the main slowdowns I see
with PyBench I cannot reproduce with timeit.py. I think I stopped trusting
PyBench when it reported the patch was 2% slower, but did so 5% faster --
consistently. So, if anyone has any *real* programs they can test the patch
with, I would be much obliged. Otherwise we'll have to check it in claiming
it gives a 20% performance boost on ... methods of newstyle classes ,,, and
30% on ... methods of old-style classes. :)

The patch is here: http://www.python.org/sf/709744

Where-...-reads-"empty-no-argument"-and-,,,-reads-"that-use-
  -PyObject_GenericGetAttr"-in-very-very-small-letters'ly y'rs,
-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!