Léo - Tinkeam created THRIFT-6159:
-------------------------------------

             Summary: Rust: Use faster varint library - #3739
                 Key: THRIFT-6159
                 URL: https://issues.apache.org/jira/browse/THRIFT-6159
             Project: Thrift
          Issue Type: Improvement
          Components: Ruby - Library
    Affects Versions: 0.24.0
            Reporter: Léo - Tinkeam
             Fix For: 0.25.0


Refer to [this PR](https://github.com/apache/thrift/pull/3739)

Changed the Rust varint library from integer-encoding to varint-rs, my 
[tests](https://github.com/Leo-Tinkeam/bench-rust-varint) on differents library 
reveal that varint-rs can be up to 2 times faster.

Also tested thrift before and after 
[here](https://github.com/Leo-Tinkeam/bench-thrift), 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to