|
如果你需要让你的Python程序加速运行,在不同的层次有一些不同的解决方案:
- 重写 你的 Python 代码, 通过 并行化parallelizing 和 优化optimizing/替代replacing/调试tuning 运算方法,比如使用:
- Hadoop 或者 Disco
- Parallel Python Python 并行运算
- Message Passing Interface (MPI)
- Bulk Synchronous Parallel (BSP)
- RPyC
- Twisted
- Profiling Tools
- 线程 thread或者 Microthreads (Stackless)
- 使用工具加速你的代码而不需要大量修改
- Psyco
- Just in time JIT 编译器,注意这是最容易使用的实现方式。
- Pyrex
- 写和编译Python,通过近似 C 风格的数据结构
- Cython
- PyJs
- 编译 (大子集) Python 为 Javascript, 注意:这更适合于客户端编程比如ajax,而非服务器端。
- Rpython
- 编译 (大子集) Python 为本地代码,注意:这是 PyPy 项目的一部分。
- Shedskin
- 编译 (大子集) Python 为 C++,这是一些测试结果: some benchmarks
- 替换 (一部分) 你的 Python 代码 为其他语言
- Simplified Wrapper and Interface Generator (SWIG)
- Fortran to Python Interface Generator (F2PY)
- llvm-py
- 编写代码和编译为汇编语言,用于运行在底层虚拟机上。
- CorePy
- Weave
- PyInline
- Boost.Python
- Cinpy
- cinpy模块利用tcc混合C代码和Python(使用ctypes)在运行时刻编译成为可执行代码
|
|
|
|
|
|
|