Numba lets you JIT (just in time) compile chunks of python down to machine-code-speeds. In theory it’s as simple as adding the @jit decorator to your methods, in practice it’s a bit more complicated!
Just a few things I’m finding while trying to convert my code to work with numba. In particular it turns out it’s better to think about numba in advance, rather than try to convert old code to work with it (I think)…
- Returning more than one variable (in a tuple). From stackoverflow, we have the useful
- Tuples are more likely to work than lists, and numpy arrays seem robust too. Basically don’t start nesting lists.