-
-
Notifications
You must be signed in to change notification settings - Fork 9
decompress.rs: faster input reading
#85
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
| if self.avail_in < 8 { | ||
| return None; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a debug assertion that no more than 7 bytes are requested? And no more than 1 byte in the case of pull_u8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well I added an assert that we can at least consume 1 additional byte, in other words that we don't ask for more input if we don't have space in the bit buffer.
The check you comment on is a bounds check, so we just skip this function if there are not 8 additional bytes in the input, there is nothing to assert there right?
6dd666f to
c78469e
Compare
attempt to read up to 7 bytes at once, cutting down on the total number of reads. This has some nice performance benefits.