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

chore(wire): add check_len to all parse methods #885

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

thvdveld
Copy link
Contributor

@thvdveld thvdveld commented Jan 3, 2024

This commit adds a call to check_len to all parse methods in the wire module. This ensures that no accessor methods are invalid, helping the compiler optimise.

server: 199.4KiB -> 197.3KiB
client: 200.2KiB -> 198.0KiB
sixlowpan: 196.8KiB -> 194.7KiB

It's a small gain, but it's worth it.

Edit: valid -> invalid

@thvdveld thvdveld force-pushed the add-check-length-to-parse branch from 4930de4 to abef4e9 Compare January 3, 2024 12:51
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (3f2a219) 79.77% compared to head (892d4d9) 79.71%.

Files Patch % Lines
src/wire/ethernet.rs 0.00% 1 Missing ⚠️
src/wire/sixlowpan/frag.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #885      +/-   ##
==========================================
- Coverage   79.77%   79.71%   -0.06%     
==========================================
  Files          78       78              
  Lines       28133    28060      -73     
==========================================
- Hits        22443    22369      -74     
- Misses       5690     5691       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@crawford
Copy link
Contributor

crawford commented Jan 3, 2024

This ensures that no accessor methods are valid…

“Invalid”?

@thvdveld
Copy link
Contributor Author

thvdveld commented Jan 3, 2024

Oh damn, yes, that's what I wanted to write...

This commit adds a call to `check_len` to all parse methods in the
`wire` module. This ensures that no accessor methods are invalid,
helping the compiler in optimizing.
@thvdveld thvdveld force-pushed the add-check-length-to-parse branch from abef4e9 to 892d4d9 Compare January 3, 2024 13:17
Copy link
Contributor

@crawford crawford left a comment

Choose a reason for hiding this comment

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

Nice. Looks like a good improvement.

@thvdveld thvdveld added this pull request to the merge queue Jan 3, 2024
Merged via the queue into smoltcp-rs:main with commit 2e7003f Jan 3, 2024
11 checks passed
@thvdveld thvdveld deleted the add-check-length-to-parse branch January 3, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants