Tutorial introducing Numba

I feel Python gets relegated to bring glue or “that thing we write some of the tools in” too much in ROS and anything performance critical or CPU heavy gets done in C++. The Numba JIT compiler does a lot to bridge this performance gap. I’ve been using it a lot lately and thought to make a reasonably thorough intro video for it. I hope it can help someone here.

7 Likes

High Performance Python is another valuable resource to implement high performance soft realtime capable systems.

1 Like

@fkromer High Performance Python is indeed a good resource.

1 Like

Another thing to consider when using compilers is code runtime predictability. AOT (ahead of time) compilation leads to predictable code runtime. When JIT (just in time) compilation ist used the first execution of e.g. a function takes way longer than following executions of the same function.

1 Like

For sure. Numba can AOT compile functions in almost all cases which is pretty nice but there’s still situations where that can’t be done. I’ve seen some folks forcibly run the functions they are providing at import time which can also be helpful.

On the subject of maturity, I would have classified Numba as an immature project when I first encountered it in 2017 but I wouldn’t say that about it now.

I personally prefer to have full and explicit control about whats going on. Forcing functions to execute once initially sounds error prone to me. However If it works for these folks … great.

Numba is great for sure. It’s just no fit for me.