One Python 2.1 idea

Neelakantan Krishnaswami neelk at
Wed Dec 27 00:30:00 CET 2000

On Tue, 26 Dec 2000 19:43:52 +0100, Alex Martelli <aleaxit at> wrote:
><rturpin at> wrote in message news:92ab9u$dou$1 at
>> Most work in a Python program involves object methods
>> or attributes. (At least, this is the case in my
>> programs. ;-) Increasing the speed of reference to
>> these should have appreciable benefit, across the
>> board. Yeah, it would make the code a bit more
>> complex to maintain. But this isn't a special case --
>> it is a general mechanism central to how Python works.
> It does seem likely that caching lookups is where most
> across-the-board performance might be gained, yes.  The trick is
> finding out a way to invalidate the cache every time some dynamic
> manipulation may need lookups to happen afresh.

I'm not sure this would help very much. Tim posted a link to an
attempt to add method caches, and reported inconclusive results.  As
of late last week, I'm not surprised; the Python interpreterseems to
be spending most of its time in bytecode instruction dispatch. Logic
suggests that that's where performance enhancements would have the
most impact.

Fortunately, I don't have to put my money where my mouth is, since
someone has already done it for me. :) Vladimir Marangozov has
modified the Python interpreter (as of 1.5) to use the GNU computed
labels extension and implemented direct threading.

Bringing that up to date with 2.0 would be an interesting experiment. 


More information about the Python-list mailing list