In the Q&A session following my EuroPython 2025 presentation about the Microdot web framework, a member of the audience asked me what the performance of MicroPython running on a microcontroller is. This took me a bit by surprise, because while I knew that microcontrollers are slow and underpowered devices, I really had no way to quantify this. I never questioned the supposedly low performance, because it was never a problem for me.
My answer to the question was that microcontrollers cannot replace a computer, and that these devices are only useful for small, focused tasks that are not demanding in any way. But after returning from the conference I kept thinking about this question, which piqued my curiosity. So I decided to build a better mental image of the performance these little machines have.
In this blog post I want to share some results that compare Python code running on a few microcontroller boards that I have collected through my experiments with hardware, along with my laptop and a Raspberry Pi 4 to help put things into perspective.
A note about benchmarks
You should know that I'm not a big fan of benchmarks. A few years ago I've written about this in a blog post that I titled Ignore All Web Performance Benchmarks, Including This One.
My feelings about benchmarks haven't changed. They are useful to form a general idea, but are often taken too literally, and used as proof that "X" is better than "Y", which is almost always a simplification. Also, benchmarking running code is actually quite difficult, because the speed of execution isn't constant and can change dramatically from one moment to the next, so you can't think of results as absolute or universal. And benchmarks are very easy to skew in one direction or another, as I demonstrated in the blog post referenced above.
All this to say that this exercise is driven merely by curiosity and is not intended to prove anything. With that out of the way, let's do some benchmarking!
The contenders
To evaluate MicroPython performance, I've decided to use a selection of the microcontrollers that I regularly test my Microdot project on. I have also included a Raspberry Pi 4 (not to be confused with the Raspberry Pi Pico line of microcontrollers) and the laptop in which I'm now writing this article, which is a Framework laptop with an Intel Core i5 CPU running Ubuntu.
The following table shows the devices that I selected, along with the RAM they have. I'm showing the Raspberry Pi 4 and the Framework laptop in italics, to highlight that they are in a completely different category and only included in the comparison to give a sense of the scale difference.
... continue reading