Skip to content

Rust: Use faster varint library - #3739

Open
Leo-Tinkeam wants to merge 1 commit into
apache:masterfrom
Leo-Tinkeam:master
Open

Rust: Use faster varint library#3739
Leo-Tinkeam wants to merge 1 commit into
apache:masterfrom
Leo-Tinkeam:master

Conversation

@Leo-Tinkeam

@Leo-Tinkeam Leo-Tinkeam commented Aug 23, 2026

Copy link
Copy Markdown

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_all once on transport but varint-rs is doing it for each byte, which is slower with our implementation of transport.write_all, I am writing to a buffer with varint-rs in order to use write_all only 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.

@mergeable mergeable Bot added the rust Pull requests that update Rust code label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant