interpreter vs. compiled

Terry Reedy tjreedy at udel.edu
Wed Jul 30 18:12:52 CEST 2008



castironpi wrote:

>> The current CPython VM does not compile code.

CPython compiles Python code to bytecode for its CPython *hardware 
independent* VM using standard compiler methdods and tools (lexer, 
parser, code generator, and optimizer).  That VM (interpreter) is 
written in portable-as-possible C, with machine/OS #ifdefs added as 
needed.

> WHY NOT?  Why doesn't CPython do it?

1. Portability: The Microsoft C# JIT compiler runs under Windows .NET on 
x86/amd64 and maybe it64 and what else?  Just porting .NET to run 0n 
Linux on the same processors was/is a bit task.  Does MONO have a JIT also?

There is a JIT for Python: Psyco.  It originally only worked on x86.  I 
am not sure what else.  It originated as a PhD project, working with 
CPython, and was developed further as part of PyPy, but I do not know if 
there is any current progress.

Python VM runs on numerous platforms.

2. Money: C#, its JIT, and IronPython were and are funded by MS. 
Getting JIT right is hard and tedious.

CPython is mostly a volunteer project. It is also the Python development 
platform.  So it has to be simple enough for volunteers to pick up on 
its innards and for experimentation to be possible.  Give the PSF more 
resources and

tjr





More information about the Python-list mailing list