If you need to speed up your Python program there are several possible approaches, with varying degrees of effort required. Here is a (likely incomplete) overview from late 2008:
1. Rewrite or Parallelize Your Python Code
Optimize, tune, or replace algorithms — or parallelize execution using:
- Hadoop or Disco — Open-source implementations of MapReduce
- Parallel Python
- Message Passing Interface (MPI) — Frequently used for numerical programming
- Bulk Synchronous Parallel (BSP)
- RPyC — RPC for distributed and parallel programming
- Twisted — Networking libraries for distributed/parallel programming
- Profiling Tools — Python standard
profile/cProfile - Threading or Microthreads (Stackless)
2. Use a Tool That Speeds Up Code Mostly Unchanged
- Psyco — Just-in-time compiler (probably the easiest first approach to try)
- Pyrex — Write and compile Python with C-style data structures
- Cython — Compiling Python-like code with optional static types to C extensions
- PyJS — Compile a large subset of Python to JavaScript (more relevant for client-side Ajax than server-side compute)
- RPython — Compile a restricted subset of Python to native code (part of the PyPy project)
- PyStream / GPULib — GPU acceleration libraries for Python
- Shedskin — Compile a large subset of Python to C++ (benchmark showing 196× math speedup)
3. Replace Parts of Python with Another Language
- SWIG (Simplified Wrapper and Interface Generator) — Call C/C++ from Python
- F2PY (Fortran to Python Interface Generator) — Call Fortran from Python
- llvm-py — Generate and compile directly to native machine code via LLVM
- CorePy — Write assembly code directly in Python
- SciPy Weave / PyInline — Inline C/C++ snippets inside Python
- Boost.Python — Interoperability between C++ and Python
- Cinpy — Blend C code with Python using
ctypesand runtime compilation viatcc