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

Optimize varint decode #62

Merged
merged 1 commit into from Sep 30, 2022
Merged

Optimize varint decode #62

merged 1 commit into from Sep 30, 2022

Conversation

bugadani
Copy link
Contributor

It's not necessary to update a check value in every cycle - it's only relevant while processing the last encoded byte.

Obligatory godbolt link, this time with x86 asm because I was lazy: https://rust.godbolt.org/z/hMh3qW67h

@netlify
Copy link

netlify bot commented Jun 21, 2022

Deploy Preview for cute-starship-2d9c9b canceled.

Name Link
🔨 Latest commit 88ec6e0
🔍 Latest deploy log https://app.netlify.com/sites/cute-starship-2d9c9b/deploys/62b18e7fc0314800084d0d73

@bugadani
Copy link
Contributor Author

Technically, in the last iteration it's unnecessary to mask the continuation bit (it's either zero or the check value catches the invalid data anyway), but that would make the impl a lot bulkier so I haven't done it.

Copy link
Owner

@jamesmunns jamesmunns left a comment

Choose a reason for hiding this comment

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

Works for me!

@jamesmunns jamesmunns merged commit 56d0a58 into jamesmunns:main Sep 30, 2022
@bugadani bugadani deleted the opt branch September 30, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants