Native machine code: passing bytearrays #16834
Replies: 3 comments 2 replies
-
Native C functions use the same collection of functions and objects that is used by Micropython internally. |
Beta Was this translation helpful? Give feedback.
-
bytearray is implemented same way as array.array with typecode='B'. |
Beta Was this translation helpful? Give feedback.
-
Thanks both @rkompass and @jonnor.
Solution 2:
Also for future readers, I implemented and benchmarked a silly function that shuffles some bits around in the bytearray in Python, Pyton+Viper and C.
To summarize: Python is great for prototyping and when no number-crunching is needed (which, I guess, covers a lot of use cases). But if you need to squeeze some performance out of these microcontrollers you don't really have a decent language supporting async. Unlucky the last time I checked, Rust was still a no go (I don't even remember what the show stopper was...). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to use a native C function (see https://docs.micropython.org/en/latest/develop/natmod.html) to process a Python bytearray. I also checked the examples under
examples/natmod/
but I only found how to deal with other types. Do you have some examples to share? Thanks.Beta Was this translation helpful? Give feedback.
All reactions