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

SDK • Re: Bulding a project for the Pico W

$
0
0
Regarding why your program would run faster, my guess is that if all of the code is in the same translation unit, moveMotors gets inlined. The compiler notices that the arguments are constant, and then computes and eliminates all the divisions that are done in moveMotor. Those divisions are not necessarily very fast on the pico, since it doesn't have a floating point unit, it has to do all of that in software.

If moveMotor is in a different translation unit, this inlining won't occur. This advantage would go away if you called moveMotor with variable values instead of a constant.

Just a shot in the dark, but that's my guess.

Statistics: Posted by jags84 — Fri May 10, 2024 2:39 am



Viewing all articles
Browse latest Browse all 8041

Trending Articles