Dedicated CPU core for Python?

John Nagle nagle at animats.com
Thu Apr 26 16:53:51 EDT 2007


Michael Hoffman wrote:
> Louise Hoffman wrote:
> 
>> I was wondering, if Python in the foerseeable future will allocate one
>> CPU core just for the interpreter, so heavy Python operations does
>> slow down the OS?
> 
> 
> When running scripts, or loading modules, Python does not really behave 
> as an interpreter. Instead it compiles the human-readable code to a 
> bytecode which it then runs on a virtual machine.

     That's how interpreters have worked since UCSD Pascal, circa 1977.
Very few direct source interpreters, where the source is reprocessed
each time a line is executed, are still used.  The original IBM PC
had one of those in ROM.  Everbody grinds the code down to some kind
of tree representation, and usually represents the tree as a string
of operations for a stack machine.  Then a little intepreter runs
the stack machine.  This is typically 10-100x slower than executing
code compiled to the real machine.

     I saw a true source interpreter in a Galil industrial
motor controller as recently as 2004, but that's one of the few
remaining uses for that obsolete technology.  When the documentation
says that comments take time to execute, you've found one of those
antiques.

					John Nagle



More information about the Python-list mailing list