Skip to content

use fastcrc if available#943

Merged
tridge merged 3 commits intoArduPilot:masterfrom
tridge:pr-fastcrc
Apr 30, 2024
Merged

use fastcrc if available#943
tridge merged 3 commits intoArduPilot:masterfrom
tridge:pr-fastcrc

Conversation

@tridge
Copy link
Contributor

@tridge tridge commented Apr 26, 2024

fastcrc runs about 3x faster than existing x25 crc

tridge added 2 commits April 27, 2024 09:25
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
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