MicroPython vs Arduino Benchmarking on an ESP32 microcontroller

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 17

  • @waylandsmith
    @waylandsmith 2 роки тому +4

    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.

    • @CMDR_Hadion
      @CMDR_Hadion 2 роки тому

      You can run Rust on the pico, though I don’t know what the library support is like.

  • @EmmanuelOga
    @EmmanuelOga Рік тому +1

    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.

  • @bootheprime
    @bootheprime 2 роки тому +2

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

  • @michaelnoardo3315
    @michaelnoardo3315 2 роки тому +3

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

  • @marc_frank
    @marc_frank 9 місяців тому

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

  • @johnsim3722
    @johnsim3722 3 роки тому

    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.

    • @TJMoir
      @TJMoir  3 роки тому +1

      Cython is a new way but I have yet to explore it

  • @jawadmezaal5192
    @jawadmezaal5192 2 роки тому

    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?

    • @TJMoir
      @TJMoir  2 роки тому +1

      If I remember, I did a ctr C or just unplugged it and plugged it back. Turn off the ESP32 too. Are you running the boot loader?

    • @jawadmezaal5192
      @jawadmezaal5192 2 роки тому

      @@TJMoir I pressed Carl+c many times, turned off the ESP32 and no thing changed. It works with Arduino IDE but not with Thonby!

  • @muhammadfarooqi
    @muhammadfarooqi 2 роки тому

    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... :'(

    • @TJMoir
      @TJMoir  2 роки тому +1

      Up to you. Just saying that Python is much faster if speed is an issue. Many applications where it isn't

    • @suryajayaweera
      @suryajayaweera Рік тому

      @@TJMoir you meant c?

    • @TJMoir
      @TJMoir  Рік тому

      @@suryajayaweera c c++ on Arduino environment