We are lucky there are very diverse solutions to make Python faster that have been in use for a while: from wrapping compiled languages (NumPy), to altering the Python syntax to make it more suitable to compilers (Cython), to using a subset of it which can in turn be accelerated (numba). However, each of these options has a tradeoff, and there is no silver bullet.
poliastro is a library for Astrodynamics written in pure Python. All its core algorithms are accelerated with numba, which allows poliastro to be decently fast while having minimal code complexity and avoid using other languages.
However, even though numba is quite mature as a library and most of the Python syntax and NumPy functions are supported, there are still some limitations that affect its usage. In particular, we strive to offer a high-level API with support for physical units and reusable functions which can be passed as arguments, which sometimes require using complex objects or introspective Python behavior which is not available.
In this talk we will discuss the strategies and workarounds we have developed to overcome these problems, and what advanced numba features we can leverage.
There are several solutions to make Python faster, and choosing one is not easy: we would want it to be fast without sacrificing its readability and high-level nature. We tried to do it for an Astrodynamics library using numba. How did it turn out?