Rust: Use faster varint library - #3739
Open
Leo-Tinkeam wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changed the Rust varint library from integer-encoding to varint-rs, my tests on differents library reveal that varint-rs can be up to 2 times faster.
Also tested thrift before and after here, 20% improvements in release mode (
cargo run --release) but 60% slower with dev (cargo run). This may be an issue but I think that dev time don't matters that much.The generated output.bin are exactly the same before and after (tested with
cmp master.bin before.bin).I did not created a JIRA ticket, I may if it's mandatory.
My usage is not the basic usage of the library, integer-encoding is using
write_allonce ontransportbut varint-rs is doing it for each byte, which is slower with our implementation oftransport.write_all, I am writing to a buffer with varint-rs in order to usewrite_allonly once at the end.I think that transport should use a fixed size buffer (something like 1ko ?) and the buffer that is up to 10o that I implemented here will became irrelevant. I'm not sure about this last observation but I may investigate if you want me to.