Why is this loop heavy code so slow in Python? Possible Project Euler spoilers

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Mon Sep 3 10:26:30 EDT 2007


Martin v. Löwis a écrit :
>>> (2) it is a interpretation language
>> Not quite. It's compiled to byte-code - just like Java (would you call
>> Java an 'interpreted language' ?)
> 
> Python is not implemented like Java. In Java (at least in HotSpot),
> the byte code is further compiled to machine code before execution;

This is a VM-specific feature.

> in Python, the byte code is interpreted.

Idem.

> Whether this makes Python an interpreter or a compiler,
> I don't know.

This is an old troll^Mdiscussion !-)

Now IANAL, but AFAIK, the byte-code compilation stage can make a great 
difference performances-wide, and for a same language, a byte-compiled 
implementation is likely to be faster than a pure-interpreted one, at 
least because of the saving on parsing time (please someone correct me 
if I'm wrong) ...



More information about the Python-list mailing list