Live data from Hacker News

Benchmarking MicroPython

blog.miguelgrinberg.com

11–15 of 15 posts

Re: Benchmarking MicroPython

#11
post #3

I'm missing testing the different emitters as demonstrated here: https://www.kickstarter.com/projects/214379695/micro-python-... Not sure whether they're supported on all the architectures, though.

I have added this now, as a reply to one of the other posts :) 100x speedup.

Re: Benchmarking MicroPython

#12

Generate 2000 random numbers and sorting them using bubble sort on 160Mhz 32bit mcu takes 80 seconds ? This is exactly why micropython is a toy.

The same can be done in 0.02 seconds with MicroPython. I posted optimized code here, https://github.com/jonnor/embeddedml/tree/master/handson/mic...

Re: Benchmarking MicroPython

#13
post #9

This should not be used to conclude on the viability of using MicroPython for numeric type tasks. For that one should at least take into account the following: Integers are much faster than floats (floats involve a pointer and a heap allocation, integers are stored in a single word/object). array.array is preferred over list for something like sort. Continuous memory representation of numbers versus general purpose l…

If anyone is interested in fast dynamic native C modules for MicroPython, you can check out emlearn-micropython - a machine learning and digital signal processing library. https://github.com/emlearn/emlearn-micropython Disclaimer: I am the maintainer

Re: Benchmarking MicroPython

#14
You can drop down to C and call it from MicroPython if you want to count cycles.

Of course, you have to recompile your C every time it changes, which is annoying when you're used to the REPL workflow.

Re: Benchmarking MicroPython

#15
post #10
post #9

This should not be used to conclude on the viability of using MicroPython for numeric type tasks. For that one should at least take into account the following: Integers are much faster than floats (floats involve a pointer and a heap allocation, integers are stored in a single word/object). array.array is preferred over list for something like sort. Continuous memory representation of numbers versus general purpose l…

Ok, you guys have successfully nerd sniped me this morning... Here some experiments showing the use of code emitter to speed this code up massively. Link to code: https://github.com/jonnor/embeddedml/tree/master/handson/mic... The results on ESP32S3 (M5Stick AtomS3U), running MicroPython 1.24.1. All times in seconds, for the 2000 number sort. bubble.py 19.119 bubble_native.py 9.482 bubble_viper.py 0.904 heapsort_vipe…

EDIT: 20x better with same algorithm, not 100x. Do not post before the coffee starts kicking in...
Post reply on HN