[Tutor] compiler

alan.gauld@bt.com alan.gauld@bt.com
Tue, 20 Nov 2001 16:22:18 -0000


> Is there nothing that will take a python script, and compile it in
> runtime executable code? Python is wonderful, but a executable in
> machine language compiled from something is a lot faster, 

Actually its not a lot faster. In fact interpreted code can be 
faster than compiled C++ - See The Practice of Programming by 
Kernighan & Pike for an example of Perl being faster than C++

It all depends on the efficiencies of the libraries and how 
much code is actually being interpreted. If you are writing 
GUIs using, say PyQt the bulk of the code is written in C/C++
adf the real performance difference of the program will be 
minimal - especially on a modern fast CPU.

> handy if ou use the thing a lot.

Actually I usually find the ability to instantly change 
the source much more useful...

Of course if you want to write shrinkwrap commercial packages 
where benchmarks asre all important then yes compiled code 
will usually edge ahead but at a huge cost in development 
effort.

BTW Python does compile mnodules that are imported into 
intermediate code - rather like VB or Java or Smalltalk. 
But the compilation is controlled by the interpreter, 
not a separate process.

Alan G