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

Faster Message string representation #1858

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Faster Message string representation #1858

merged 1 commit into from
Sep 13, 2024

Conversation

pierreluctg
Copy link
Collaborator

@pierreluctg pierreluctg commented Sep 12, 2024

Improved the speed of data conversion to hex string.
This also as a result improves the can.Printer logger performance.

Main Branch

$ python -m timeit -s "import can" "str(can.Message(data=(_ for _ in range(64))))"
20000 loops, best of 5: 14.7 usec per loop

This PR

$ python -m timeit -s "import can" "str(can.Message(data=(_ for _ in range(64))))"
100000 loops, best of 5: 3.47 usec per loop

Improved the speed of data conversion to hex string
@pierreluctg pierreluctg added enhancement file-io about reading & writing to files labels Sep 12, 2024
@pierreluctg pierreluctg marked this pull request as ready for review September 12, 2024 16:24
Copy link
Collaborator

@felixdivo felixdivo left a comment

Choose a reason for hiding this comment

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

🥳

@pierreluctg pierreluctg merged commit 757370d into main Sep 13, 2024
61 of 62 checks passed
@pierreluctg pierreluctg deleted the message-fast-string branch September 13, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement file-io about reading & writing to files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants