Skip to content
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

use fastcrc if available #943

Merged
merged 3 commits into from
Apr 30, 2024
Merged

use fastcrc if available #943

merged 3 commits into from
Apr 30, 2024

Conversation

tridge
Copy link
Contributor

@tridge tridge commented Apr 26, 2024

fastcrc runs about 3x faster than existing x25 crc

3.5 was EOL in 2020, and doesn't support fastcrc
@tridge tridge requested a review from peterbarker April 27, 2024 01:11
Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of ancient code being duplicated, so we're adding sub-optimal stuff in.... but at least it's well-tested sub-optimal stuff.


def accumulate(self, buf):
"""add in some more bytes (it also accepts strings)"""
if sys.version_info[0] == 2:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really be adding Py2 compat here?

buf = bytearray(buf.encode())
elif type(buf) is str:
buf = bytes(buf.encode())
elif type(buf) is list:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all of these be isinstance?

for performance testing
@tridge tridge merged commit 8ba6707 into ArduPilot:master Apr 30, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants