gitmyhub

numba

Python ★ 11k updated 2d ago

NumPy aware dynamic Python compiler using LLVM

Numba speeds up Python numerical code by compiling it to machine code at runtime using LLVM, add one decorator to a function and it runs dramatically faster, with optional GPU and multi-core support.

PythonLLVMNumPyCUDAsetup: moderatecomplexity 3/5

Numba is a tool that makes Python code run much faster, particularly code that does a lot of number crunching. Python is known for being easy to write but slow to execute compared to lower-level languages. Numba bridges that gap by compiling your Python functions into machine code at the moment they are first called, using a technology called LLVM that many professional compilers rely on.

The main audience is scientists, engineers, and data analysts who write Python code that works with large arrays of numbers. Numba is built to work closely with NumPy, a library for numerical computing that is widely used in that community. You add a single decorator (a short annotation above a function) and Numba takes care of the compilation automatically, with no need to rewrite your logic in a faster language.

Beyond speeding up regular Python loops and math operations, Numba can also run code on a GPU (the graphics processor, which excels at doing many calculations in parallel). It also supports automatic parallelization, meaning it can split certain loops across multiple processor cores without you having to write any threading code yourself.

Numba is sponsored by Anaconda, a company that builds tools for data science, and is free to use under an open source license. The README is brief and points to the project website and documentation for installation steps and full details. Demo notebooks are available via the mybinder.org service if you want to try it without installing anything locally.

Where it fits