Modules and Inline C #7849
-
I'm putting together a module that needs to calculate a check sum. I have 2 working implementations that successfully calculate the check sum. Performance wise a) is around 8 times faster than b). Would there be any disadvantages to having Inline c code in a module ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Well, the Inline C code ends up having to be run through the compiler on our server first, but I don't see that's a big problem as the App Loader is able to do that (although only for ARM-based devices, not ESP32/etc). As you have both, maybe include the JS one in a comment in the file just in case? Just to check, Espruino does have |
Beta Was this translation helpful? Give feedback.
-
Thanks Gordon, I just tried the E.CRC32 in case it was the same, unfortunately its not. The calculation seems to take just over 1ms for the c code and around 10ms for the javascript (Although I'm not giving any guarantees that it cant be improved). So its not a huge difference either way. I do like the idea of including the alternative as a comment so that the choice can be switched over later. |
Beta Was this translation helpful? Give feedback.
Well, the Inline C code ends up having to be run through the compiler on our server first, but I don't see that's a big problem as the App Loader is able to do that (although only for ARM-based devices, not ESP32/etc). As you have both, maybe include the JS one in a comment in the file just in case?
Just to check, Espruino does have
E.CRC32
built in - does that not produce the right values for you?