Can I compile Python for the web?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles

    #1

    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
  • Peter Hansen

    #2
    Re: Can I compile Python for the web?

    Charles wrote:[color=blue]
    > 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.[/color]

    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

    Comment

    • Terry Hancock

      #3
      Re: Can I compile Python for the web?

      On Friday 23 September 2005 07:53 pm, Peter Hansen wrote:[color=blue]
      > 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?".[/color]

      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

      Comment

      Working...