Can I compile Python for the web?

C

Charles

Dear sirs,

I'm doing some investigations on the Python language.
I'd like to know if it is possible to compile Python code made for the web
(an online database for instance), and to run it using mod_python. How is
it possible? I think it would be very fast to execute the code if it were
compiled.
Thanks,
 
P

Peter Hansen

Charles said:
I'm doing some investigations on the Python language.
I'd like to know if it is possible to compile Python code made for the
web (an online database for instance), and to run it using mod_python.
How is it possible? I think it would be very fast to execute the code
if it were compiled.

Python code is already compiled, specifically to .pyc files, though this
is clearly not what you meant by the above. (The .pyc files contain
"bytecode" which is executed by the Python virtual machine, much like a
CPU executes its native opcodes, or like Java executes its own bytecode
instructions.)

What you appear to be asking is if it's possible to create *native
machine code* from Python source in order to achieve a significant
increase in performance. The short answer is "no, not really", and
longer answers include "yes, sort of, using something like Psyco", and
"who cares because it wouldn't give you much better performance for a
web-based application where you're probably either I/O-bound or limited
by the speed of the non-Python database solution you are using in the
first place?".

-Peter
 
T

Terry Hancock

What you appear to be asking is if it's possible to create *native
machine code* from Python source in order to achieve a significant
increase in performance. The short answer is "no, not really", and
longer answers include "yes, sort of, using something like Psyco", and
"who cares because it wouldn't give you much better performance for a
web-based application where you're probably either I/O-bound or limited
by the speed of the non-Python database solution you are using in the
first place?".

All pretty true of course, but I think I did read about some tests of
running Zope with psyco. Zope uses a pretty massive amount of Python
code on each access, so there's probably a lot to optimize. Unfortunately
I don't remember what the results were.

But I'd recommend search the zope-user mailing list archives or just
google for "psyco site:zope.org"

Terry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,323
Members
48,005
Latest member
ChasityFan

Latest Threads

Top