Speeding up Python Code with Numba
Numba is a just in time (JIT) compiler for Python and NumPy code. From their official website, "Numba translates Python functions to optimized machine code at runtime using the industry-standard LLVM compiler library. Numba-compiled numerical algorithms in Python can approach the speeds of C or FORTRAN."
@jit(nopython=True)
def function_to_be_compiled():
# Standard numerical/NumPy code here
...
Importantly, many functions require no changes or refactoring to gain this speedup. In this getting-started guide, we build an example environment on Eagle, test the performance of a Numba-compiled function using the most common implementation of the @jit
decorator, and discuss what sorts of functions will see performance improvements when compiled.