3 ms·
MicroPython is also a lot slower than Arduino style C++. Like, a LOT. So much slower that I am sort of amazed that MicroPython has any traction at all. An 80
by naikrovek 6y ago
MicroPython is also a lot slower than Arduino style C++. Like, a LOT. So much slower that I am sort of amazed that MicroPython has any traction at all.
An 80MHz microcontroller running C can go about as fast as a 800MHz microcontroller running MicroPython, if the benchmarks a friend showed me are accurate.
An 80Mhz microcontroller is a lot cheaper than an 800 MHz microcontroller, though the difference is getting smaller.
- chrisshroba 6y agoI'm not particularly surprised. Many hobbyists just need their microcontroller to periodically poll some sensor data, or actuate a servo when a button is pressed, etc., and the convenience of programming in Python trumps a 10x speed improvement.
- rixed 6y agoIt may not always trumps a 10x shorter battery lifespan, though.
- syntaxing 6y agoI think hardware cost is secondary for hobby projects compared to learning curve cost. C is very intimidating (and annoying sometimes) compared to Micropython. It definitely promotes bad coding hygiene but I don’t really care if I just want something quick and dirty for my own small project.
- mumblemumble 6y agoI'm not surprised. I don't doubt you one bit about the performance difference, but, given how much fun I've had toying with MicroPython the BBC micro:bit (16MHz ARM Cortex-M0), I just don't care. I'm comfortable with C, and have had plenty of fun with Arduino, and I would happily switch to it if my performance needs required it. But, insofar as MicroPython lets me get from idea to working thing much more quickly, and insofar as my ideas are never something that require much performance, MicroPython boards have become the thing I reach for first when I'm looking to have some fun after dinner.
- fomine3 6y agox10 slower is better than I expected.
- belval 6y agoThe maker landscape is insanely wide these days, MicroPython has traction because someone with little prior experience can look at the script, say "I understand some of that" and get hacking. I see it as the gateway drug of embedded development, you get pulled in by how easy it looks and then you move one to a more performant language when you need it.
- ramary 6y agoTotally agree here - IMO MicroPython is great for simplifying embedded development for beginners and broadening the group of people who are interested in taking the plunge. Arduino had/has the same impact (both the hardware simplicity and C SDKs in the IDE). It's intimidating jumping into embedded if step 1 is "use the vendor-supplied startup code to enter into `main()`, then start writing baremetal C with so-so (and in some cases no) C lib support owing to being on a resource constrained platform." MicroPython doesn't offer a full Python standard lib implementation, but the standard Python syntax is definitely more accessible to a broader group of developers who may not be familiar with C or Rust. OpenMV has used MicroPython to great effect. It's really impressive what they've done, especially in the realm of porting vision algorithms to constrained platforms like Cortex-M's.
- matt_trentini 6y ago...or not and realise that professional development is not only possible in MicroPython but can significantly reduce development time - and costs - to your client. (I work for a company that makes medical devices that use MicroPython.)
- belval 6y agoDid not want my comment to come across as discrediting people legitimately using MicroPython. It was more of a comment on how embedded dev was a wide field that encompasses a lot of use cases.
- stjohnswarts 6y agoMemory is also gonna be far smaller as well.
- matt_trentini 6y agoThe difference in real-world use isn't nearly so pronounced in my experience. MicroPython is written in C, so whenever you're using modules implemented natively then you're only paying for a small boundary crossing. For example, all of the machine API is typically very fast. I'd be surprised if you'd notice a significant improvement sending SPI buffers directly from C. But it's way more convenient from MicroPython - especially considering you can do it live at a REPL. If you're spending a lot of time processing in MicroPython then yes, you'll notice a perf hit. But, if that's the case, carve out the perf-sensitive code and create a C module in MicroPython; it's straightforward. It's akin to the way that CPython is considered slow but by using libraries like numpy or pandas the real-world performance is decent.