[Slightly-OT] Wasn't Google supposed to be "avid Python-Users" ?

Michael Abbott michael at rcp.co.uk
Thu Feb 7 08:15:14 EST 2002


Michael Hudson <mwh at python.net> wrote in news:uk7tpa574.fsf at python.net:

> Michael Abbott <michael at rcp.co.uk> writes:
> 
>> I reckon to pay a cost of perhaps a factor of 100 in raw CPU for the 
>> privilege of using Python. 
> 
> But not over Java, surely?  I guess a JIT or native compilation will
> help, but...

I think so.  Java byte codes are pretty low level, and don't have to do 
very much, and of course JIT or native compilation can be *very* effective.  
Python byte codes are, on the other hand, much more powerful, and have to 
do quite a lot of run-time work.

If you're doubtful, take a quick peek at what the Python byte code 
interpreter does to implement a method call (I'm thinking of call_object in 
ceval.c).  There's nothing wrong with this (that's not my point), but 
there's quite a lot of work to be done (including memory allocation, I'm 
afraid).

This is one of the most widely used operations in the language (excepting, 
perhaps, method lookup), and can be reduced in a natively compiled language 
to a small handful of instructions or even eliminated (when we're lucky).

My factor of a 100 is a guess; am I wrong?  I believe it's fair.



More information about the Python-list mailing list