4

We really like Psyco to speed things up, but it also has some drawbacks:

  • it consumes too much memory
  • it can also slow some code down
  • compiling your code can take too much time
  • it doesn't support 64-bit systems

What would be good alternatives (Django support required)?

Wouter Dorgelo
  • 11,770
  • 11
  • 62
  • 80
  • Terminology nitpick: Psyco isn't a compiler from Python to C, it's a JIT compiler. Python to C compilers exist, but they are entirely different beasts. For starters, they don't support the full language and the compilation step can be quite a hassle compared to a regular interpreter integrating a JIT. –  Nov 28 '11 at 20:38
  • Ah.. First time we heard about it was here: http://highscalability.com/blog/2008/3/12/youtube-architecture.html where they are stating: "psyco, a dynamic python->C compiler". – Wouter Dorgelo Nov 28 '11 at 20:43
  • 1
    so dont spread the mistake and point to the [right source](http://psyco.sourceforge.net/introduction.html) – joaquin Nov 28 '11 at 21:59

2 Answers2

5

You could try using PyPy, which is an implementation of Python in Python. It is a replacement for the standard CPython implementation and boasts large speed increases.

From its website:

Speed: thanks to its Just-in-Time compiler, Python programs often run faster on PyPy.

Memory usage: large, memory-hungry Python programs might end up taking less space than they do in CPython.

Compatibility: PyPy is highly compatible with existing python code. It supports ctypes and can run popular python libraries like twisted and django.

Wilduck
  • 13,822
  • 10
  • 58
  • 90
2

I believe that PyPy runs django now. PyPy is a pure-python jit for python code, and can provide dramatic speedups in some circumstances. Only a limited set of compiled modules are supported though.

James
  • 24,676
  • 13
  • 84
  • 130