Numba vs Cython
numbacythonpythonperformancejitllvmscientific-computing
Abstraction: Benchmarking Numba JIT versus Cython for Python numerical speedup
Key points:
- Pure Python pairwise distance on 1000x3 array takes 12.1 seconds; Numba version with a single
@jitdecorator reduces this to 15.5 ms — a ~780x speedup - Cython version with type annotations runs at 9.86 ms, about 30% faster than Numba in this test
- Numba uses LLVM for just-in-time compilation, requiring only a decorator added to existing Python code
- Cython requires type specifiers, imports, and a compilation step — more work but marginally faster at the time
- Author (Jake VanderPlas) notes he had years of Cython experience vs one hour with Numba, so Numba results could improve with tuning
Connections: Numba · Cython · Jit Compilation · Python Performance
Source: http://jakevdp.github.io/blog/2012/08/24/numba-vs-cython/