One Python 2.1 idea

Neelakantan Krishnaswami neelk at alum.mit.edu
Tue Dec 26 19:28:39 EST 2000


On 26 Dec 2000 15:47:36 -0800, Aahz Maruch <aahz at panix.com> wrote:
>In article <slrn94ie9k.anf.neelk at alum.mit.edu>,
>Neelakantan Krishnaswami <neelk at alum.mit.edu> wrote:
>>
>>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 interpreter seems 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.
>
> Would making this standard require a Python installation to use a GNU
> compiler?  Or is this just a library that can be linked in?

It's a compile-time option.

The big while-loop in ceval.c has been macrofied, and the definitions
of the macros are different depending on whether gcc is available or
not. If gcc is available, then computed jumps are used, and if not it
expands into the regular while loop. (I understand this is the usual
thing to do when writing portable direct-threaded interpreters in C.) 
After compilation I don't think there is any effect except speed on
how Python behaves for users and C extensions.

A webpage on what threading is (it's unrelated to multithreading, just
a case of overloaded terminology) and to what extent it is a good
thing can be found at:

  http://www.complang.tuwien.ac.at/forth/threaded-code.html

This site is actually where I found the link to Vladimir Marangozov's
webpage. 


Neel



More information about the Python-list mailing list