-
Notifications
You must be signed in to change notification settings - Fork 1.7k
optimize CRC-8 checksum with lookup table #3028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
jyoung8607
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to optimize this routine, but there's no need to store the LUT. It makes more sense to generate them at startup, as we do for the other CRC algorithms.
I would merge a version of this that adds CRC8BODY to crc.py with poly 0xD5. See the CRC8J1850 example in the Chrysler car port.
|
can also use a @cache instead of globals to cache the generation if you go this route |
Generate CRC-8 table with polynomial 0xD5 at import time, following the existing pattern for other CRC tables.
Replace hardcoded 256-entry lookup table with import from shared crc module, following reviewer feedback.
|
went with the CRC8J1850 example |
|
@sshane @jyoung8607 are you guys interested in performance optimizations for opendbc? |
Yes, but they need to be visible changes that someone will notice, not micro-optimizations. Making tests faster is a good place to start, e.g. #3024. |
|
sounds good, I'll see what I can come up with. |
|
No car changes detected |
Replace bit-by-bit CRC-8 calculation with precomputed lookup table for improved performance.