Python interpreter speed
chambon.pascal at wanadoo.fr
Sun Apr 19 18:25:41 CEST 2009
I'm not expert in low level languages, but I'd say that Python and Java
are "compiled" to bytecodes of similar level. The difference lies in the
information contained in those bytecodes : java is statically typed, so
attribute access and other basic operations are rather quick, allowing
few levels of indirection. Whereas a python attribute lookup can involve
a big number of operations (browsing the inheritance tree, querying
__getattribute__, __get__ and all those magic methods...). That's in
this "magic" of python that we have a loss of performance I think -
that's both the power and the drawback of this (awesome) language.
PS : I guess core python developpers will have much more accurate things
to say about it ^^
Ryniek90 a écrit :
> Standard Python interpreter's implementation is written in C language.
> C code while compilation, is compilled into machine code (the fastest
> code). Python code is compiled into into byte-code which is also some
> sort of fast machine code. So why Python interpreter is slower than
> Java VM? Being written in C and compilled into machine code, it should
> be as fast as C/Asm code.
> What's wrong with that?
> Greets and thank you.
More information about the Python-list