473,765 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I compile Python for the web?

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,

--
Charles.

Desenvolvimento e criação de sites: www.auriance.com
Hospedagem de sites e servidores dedicados: www.auriance.net
Sep 24 '05 #1
2 1692
Charles wrote:
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
Sep 24 '05 #2
On Friday 23 September 2005 07:53 pm, Peter Hansen wrote:
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
--
Terry Hancock ( hancock at anansispacework s.com )
Anansi Spaceworks http://www.anansispaceworks.com

Sep 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2886
by: Grzegorz Dostatni | last post by:
Cheers. First what I am trying to do: I am trying to create a version of pytho23.dll that contains everything inside of it. It is staticaly linked. It also needs to contain the qt library. For this I am trying to work off of instructions designed for unix/linux using visual c++.net and gui. I can compile basic python - that's not a problem. Once I add the paths and dependencies for qt (as well as modifying the config.c) I get an error:
1
1168
by: vincent delft | last post by:
I've a module written in C and the associated setup.py. Work fine (and compile fine with mvc) with Python 2.3.x Now I've installed Python 2.4 (all the rest unchanged) When I try to compile it, I've got a message saying that .NET SDK must be installed. ???? Am I the only one having this problem (not found by looking for in Google) ? Is this link to Python 2.4 or my own config ?
8
2815
by: janeaustine50 | last post by:
Python's InteractiveInterpreter uses the built-in compile function. According to the ref. manual, it doesn't seem to concern about the encoding of the source string. When I hand in an unicode object, it is encoded in utf-8 automatically. It can be a problem when I'm building an interactive environment using "compile", with a different encoding from utf-8. IDLE itself has the same problem. ( '<a string with non-ascii-encoding>' is...
4
2058
by: Jari Aalto | last post by:
Please suggest comments how can I make this script to work from bash. Also how can I skip better the argument from command line without hte extra variable i? #!/bin/bash function compile () { python -c ' import os, sys, py_compile;
4
8467
by: livin | last post by:
my log... INFO urllib.urlopen('http://192.168.1.11/hact/kitchen.asp', urllib.urlencode({'Action': 'hs.ExecX10ByName+Kitchen+Lights%2C+On %2C+100&x=4&y=6'})) INFO INFO File "Q:\python\python23.zlib\urllib.py", line 78, in urlopen INFO File "Q:\python\python23.zlib\urllib.py", line 159, in open INFO File "Q:\python\python23.zlib\urllib.py", line 957, in splittype INFO AttributeError
4
5906
by: nickpreiser | last post by:
Hi Everyone, I trying to get a build of Python together to run on an Embedded Linux / Mips machine. I run the ./configure --host= XXXmips(my mips proc) --build=XXX x86(my pc). and the configure runs perfectly. I then run "make" and it fails . I have also tried appling some patches, and running autoconf , but I end up with the same compile errrors.
0
1854
by: Fuzzyman | last post by:
Hello all, The following is a copy of a blog entry. It's asking a question about future statements and the built in compile function. I'd appreciate any pointers or comments about possible approaches. `Movable Python <http://www.voidspace.org.uk/python/movpy/>`_ supports running both Python scripts and ``.pyc`` bytecode files. It does this by compiling scripts to bytecode, or extracting the code object from bytecode files, and then...
14
5524
by: mistral | last post by:
Need compile python code, source is in html and starts with parameters: #!/bin/sh - "exec" "python" "-O" "$0" "$@" I have installed ActivePython for windows.
0
1612
by: Martijn de Munnik | last post by:
Hi, I'm trying to build/install pysqlite on a Solaris 10 platform. I've got Sun Studio 11 on a AMD 64 platform and got this error. I'm a python newbie and just want to install trac. I've got ActiveState python: ActivePython 2.4.3 Build 11 (ActiveState Software Inc.) based on Python 2.4.3 (#1, Apr 3 2006, 18:07:58) on sunos5 Type "help", "copyright", "credits" or "license" for more information.
2
2228
by: jmtulloss | last post by:
Hello all, I've been trying to get Python to cross compile to linux running on an ARM. I've been fiddling with the cross compile patches here: http://sourceforge.net/tracker/index.php?func=detail&aid=1597850&group_id=5470&atid=305470 and I've had some success. Python compiles and now all of the extensions do too, but when I try to import some of them (time, socket, etc.), they have trouble finding certain symbols. Py_Exc_IOError and...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.