MicroPython vs Arduino Benchmarking on an ESP32 microcontroller

preview_player
Показать описание
There is a lot out there comparing c based Python and C++ on PCs but little on comparison in micros. This video explores the differences from running MicroPython and Arduino on a small position servo. A simple benchmark is demonstrated.
Рекомендации по теме
Комментарии
Автор

Thanks! At this speed difference is not a big deal since the difference in performance is huge, but usually you would like to run your loops a few thousand times and calculate average, min, max, and std dev of the full runs for a more detailed comparison.

EmmanuelOga
Автор

Thank you for this! I'd been wondering about it for a few weeks now

bootheprime
Автор

I've been playing around with µPython on ESP32 for a while now. Two things to note: Version 1.18 of µPython is 2-3x as fast as previous versions. Secondly, the 'viper' code emitter is about 10x as fast as interpreted code if you're doing any sort of math in a loop. Just check the chapter of the µPython manual on optimization. Finally, I was able to get native compiled modules working with very little trouble, so you can drop down to code that will perform identically to the Arduino if necessary.

That all said, if you're using the ESP32 to perform one, straightforward task that's at all performance sensitive, it makes sense to just use Arduino. But the ESP32 has SO many capabilities packed into it it's pretty easy to come up with uses for it where if you can spare the CPU cycles, you can throw together a complicated system with µPython that performs more than adequately. Arduino (C++) and Python are pretty much on the opposite sides of each other in terms of performance, complexity and ease-of-use, which makes this comparison interesting. I wish there was a solution that lands in the middle (maybe golang?), but I don't see anything that's mature yet.

waylandsmith
Автор

i tested with a button to trigger one servo and one led, both with Micropython and Arduino, man, Arduino is way way faster

michaelnoardo
Автор

Is there a way to take the interpreted language and pre-compile it? I think with BBC Basic you could run as an interpreted language but there was also a away that could be compiled, and a lot of programs used this method apparently. BBC Basic was already quick as it was.

johnsim
Автор

i guess it's the same tradeoff as on a pc, speed of developement vs speed of execution

marc_frank
Автор

I try to use Thonny for ESP32 but I get this message Device is busy or does not respond. Your options:

- wait until it completes current work;
- use Ctrl+C to interrupt current work;
- reset the device and try again;
- check connection properties;
- make sure the device has suitable MicroPython / CircuitPython / firmware;
- make sure the device is not in bootloader mode.


esptool installed by default and I installed the firmware and all the time the same message comes. Do you know how to fix this one?

jawadmezaal
Автор

so.. you want me not to learn python and learn c++.. such comparison are just for this kind of thoughts.... While I've completed my first complete robotic arm in python... :'(

muhammadfarooqi