Delegate CRC calculation to fastcrc when it is installed#1066
Delegate CRC calculation to fastcrc when it is installed#1066tridge merged 10 commits intoArduPilot:masterfrom
Conversation
…pass" This reverts commit 6f46827.
|
CI jobs are failing because |
I'd be happy with either solution. Would crcmod-plus be any better for the type info? |
|
No, both libraries are typed. The advantages of I'll modify the |
|
All green now. |
This PR delegates the calculation of the CRC checksum in MAVLink messages to thecrcmod-plusmodule when it is installed, falling back to the previous pure Python implementation if needed.This PR delegates the calculation of the CRC checksum in MAVLink messages to the
fastcrcmodule when it is installed, falling back to the previous pure Python implementation if needed.In my benchmarks, with real MAVLink traffic from ~1000 drones (recorded by Wireshark), this boost the speed of the MAVLink Python parser from 54K packets per second to 100K packets per second.
Note that I have not declaredcrcmod-plusas a dependency (not even as an optional extra) yet because I don't know what the preferred solution would be. I would probably declare it insetup.pyas an optional dependency and leave it up to the user to decide whether they are okay with an extra C module as a dependency or not.crcmod-plusprovides wheels for all the major Python distributions and versions, with an ABI3 interface for future-proofing, so it is a low-risk dependency in my opinion, unlikely to cause any problems for end users ofpymavlink.fastcrcis now declared as a dependency insetup.pyin theinstall_requiressection.