I'm fairly sure there are also a number of core types present in stock firmware which have their own attr implementation, possibly making them behave differently with regards to property performance in comparision with Python classes.running against a stock firmware image
Comparison of overheads of micropython operations
Re: Comparison of overheads of micropython operations
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Comparison of overheads of micropython operations
I agree with all of that. In spades
In terms of practical experience developing MicroPython applications (and elsewhere) the key is to identify the section of code which presents the bottleneck. Often it's quite small, maybe a single function or method. You can then pull out all the stops to optimise that: cache bound variables in locals, try different constructs, use Viper, measure the outcome of every change. As you say, if it's still too slow use the inline assembler.
If the code is to be maintained by others comment the hairy section thoroughly.
The bulk of the code should be written for clarity and ease of maintenance.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.