noob question regarding the interpreter
Hello, I know this is a n00b question, so I apologize ahead of time. I've been taking a look at they python interpreter, trying to understand how it works on the compiled byte-codes. Looking through the sources of the 2.4.1 stable version, it looks like Python/ceval.c is the module that does the main dispatch. However, it looks like a switched interpreter. I just find this surprising because python seems to run pretty fast, and a switched interpreter is usually painfully slow. Is there work to change python into a direct-threaded or even JIT'ed interpreter? Has there been previous discussion on this topic? I'd greatly appreciate any pointers to discussions on this topic. Thus far my google-fu has not turned up fruitful hits. Thanks in advance for any help! -Jing
On Thu, Apr 28, 2005 at 05:47:18PM -0400, Jing Su wrote:
Is there work to change python into a direct-threaded or even JIT'ed interpreter?
People have experimented with making the ceval loop use direct threading. If I recall correctly, the resulting speedup was not significant. I suspect the reason is that most of Python's opcodes do a significant amount of work. There's probably more to be gained by moving to a register based VM. Also, I think direct threading is hard to do portably. If you are interested in JIT, take a look at Psyco. Neil
However, it looks like a switched interpreter. I just find this surprising because python seems to run pretty fast, and a switched interpreter is usually painfully slow.
This just proves how worthless a generalization that is. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (3)
-
Guido van Rossum
-
Jing Su
-
Neil Schemenauer