-
Notifications
You must be signed in to change notification settings - Fork 406
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
Speed up Decode and Encode timing #774
Comments
Hi @xRowe thanks for doing the measurements! It would be easy to implement some dictionary to allow quick search message by name or id. Bitstruct on the other hand is (or at least was) not able to handle multiplexed messages. |
Thanks for your reply. There are commits along with implementing the DICTs already, canmatrix/src/canmatrix/canmatrix.py Lines 1994 to 2002 in e7ce2aa
canmatrix/src/canmatrix/canmatrix.py Lines 2029 to 2036 in e7ce2aa
And I create/add the data here, but I think the way is not good enough, and not cover all the cases. canmatrix/src/canmatrix/canmatrix.py Lines 2075 to 2089 in e7ce2aa
Though my project is running these code, I did not run the benchmark then. If you have better idea, please improve it. Thanks, |
An issue relate to this topic. For my working project, it need to decode ethernet pdu. If a DICT sort ethernet frames/pdu by header_id, will occur issue in such situation. So necessary to disscus with you the solution Another Issue canmatrix/src/canmatrix/formats/arxml.py Lines 2181 to 2189 in 7fde135
|
I see there is a old thread on this topic, check if this topic can be carried on.
#362
Is there any new solution to speed up decoding and encoding timing?
Online receving Messages by python-can and decoding: canmatrix v.s cantools
Example Test Code
canmatrix
decode
Mean +- std dev: 49.1 us +- 36.5 us (2207 values)
Mean +- std dev: 97.4 us +- 182.5 us (12201 values)
received_message + decode
Mean +- std dev: 147.1 us +- 157.3 us (12201 values)
cantools
decode
Mean +- std dev: 30.0 us +- 29.9 us (2200 values)
Mean +- std dev: 34.8 us +- 35.9 us (12201 values)
received_message + decode
Mean +- std dev: 64.9 us +- 57.7 us (12201 values)
After looking at cantools solution, after database is parsed, it will generate a _codec info which allowed to more quickly encode/decode a message, and generate two dicts which allow quick search message by name or id.
But canmatrix, everytime when receive a raw message, I need to found it in database by using
for test in self.frames:
, when call decode() method, it try to upack the data bybytes_to_bitstrings()
andbitstring_to_signal_list()
, which also using for loop.I do not if bitsruct may help better, and refer to cantools
The text was updated successfully, but these errors were encountered: