-
Notifications
You must be signed in to change notification settings - Fork 473
Faster parity calculations for SerialPIO when using multiple instances #2932
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
ahmedarif193
pushed a commit
to ahmedarif193/arduino-pico
that referenced
this issue
May 1, 2025
use LUT for faster parity checks, reduces CPU load with multiple instances
ahmedarif193
pushed a commit
to ahmedarif193/arduino-pico
that referenced
this issue
May 1, 2025
use bit manipulation technique from http://www.graphics.stanford.edu/~seander/bithacks.html#ParityParallel for parity calculation
ahmedarif193
pushed a commit
to ahmedarif193/arduino-pico
that referenced
this issue
May 1, 2025
use bit manipulation technique from http://www.graphics.stanford.edu/~seander/bithacks.html#ParityParallel for parity calculation
earlephilhower
pushed a commit
that referenced
this issue
May 1, 2025
use bit manipulation technique from http://www.graphics.stanford.edu/~seander/bithacks.html#ParityParallel for parity calculation Co-authored-by: Ahmed ARIF <contact@eotics.com>
Fixed by #2933 |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Right now, SerialPIO calculates parity with a bit loop that gets slower with more data bits. If you're running several soft serial ports (like 4+), it starts eating CPU for no good reason.
A small lookup table (256 bytes) could do the same job way faster, basically constant time, just a few instructions per byte versus 60+ instructions for 8-bit data for example.
Tradeoffs:
I'm happy to send a PR for this.
The text was updated successfully, but these errors were encountered: