Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: reduce CrcReader::sum calls in GzEncoder::read_footer #454

Merged
merged 3 commits into from
Feb 13, 2025

Conversation

CosminPerRam
Copy link
Contributor

Reduces calls to CrcReader::sum (which clones 16 bytes).
Replaces manual shifting with rust-provided to_le_bytes.
Moved explicit reference from declaration to usage.

I think this would technically be a perf improvement, but there is no real world difference in it at all (godbolt here).

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

It's interesting that the optimizer seems to do all that anywhere so this change doesn't lead to any differences after all, despite of course, being easier to read, a big win in my book.

@Byron Byron merged commit 5c6eaec into rust-lang:main Feb 13, 2025
14 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants