[Python-Dev] Python is faster than C

Jewett, Jim J jim.jewett at eds.com
Tue Apr 6 10:41:44 EDT 2004


Dave Cole:

> Would it make sense to build specialisation into the base Python
> interpreter so that it builds specialised versions of bytecode for
> functions.  I am assuming that there are only a few types that can be
> targeted by specialisation (int, float).  Bytecodes then could be added
> to the interpreter which operate on those native machine types rather
> than the Python objects.

If you add too many specializations, you blow the cache.
If you add not enough, then you help only certain types of programming.
If you're willing to do that, you might consider going even farther, as in 
http://www.foretec.com/python/workshops/1998-11/proceedings/papers/aycock-21
1/aycock211.html

Basically, he creates a large number of pseudo-codes that just mean
"do this, then this, then this" without going back to the eval loop
in between.  Because he knows what is coming next, there are additional
chances for optimizations.

-jJ



More information about the Python-Dev mailing list