Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4883

SDK • Re: Raw SDK performance is worse than arduino-pico

$
0
0
Thanks all for your interest and comments! To enable easier testing for you, I uploaded all files into a Github repo, which includes the C sdk code, arduino code, and python script for serial communication. I double checked that the clock speed is the same for both sides, but there may be other details that I am missing: https://github.com/alpylmz/pico_test

There is no floating point operations in rnea.hpp, it is only int32 and int64 operations. I said it is "simple" because it does not include ifs or loops or function call, it is just addition, subtraction, multiplication, casting and shifting. I assumed that arduino-pico and C sdk use the same compiler. That's why I was surprised to see 2x speed difference in calculation, but if it is not, that may explain the difference, though that may also suggest C sdk needs better int64 emulation.
A couple other things SDK scanf has way more overhead than Arduino and may block input buffer if not large enough. Less overhead with Arduino Serial.parseInt so use a custom input parser with something like the SDK get character with timeout https://www.raspberrypi.com/documentati ... 9799c40b73

Also absolute_time_t and functions like get_absolute_time adds more overhead.

Use UART serial instead of USB CDC if possible.

Use -O2 on a release build not debug.
Thank you! I'll try a custom input parser and UART serial as soon as I can.

Statistics: Posted by alpylmz — Thu Jan 09, 2025 10:49 pm



Viewing all articles
Browse latest Browse all 4883

Trending Articles