thrift icon indicating copy to clipboard operation
thrift copied to clipboard

Profile the rust library.

Open in-the-mood-for-mov opened this issue 9 years ago • 8 comments

The Rust library is ~100x slower than the C++ version. Lets run a profiler to find out why.

in-the-mood-for-mov avatar Jan 26 '15 03:01 in-the-mood-for-mov

Good news, after a suggestion at the last meetup to use BufferedStream the numbers are much better:

[golov@localhost rs]$ time ./target/release/calculator ping() 0 100 ... 1700 1800 1900 1 + 1 = 2 PASS

real 0m0.107s user 0m0.016s sys 0m0.016s

Compared with C++: [golov@localhost cpp]$ time ./TutorialClient ping() 0 100 ... 1700 1800 1900

real 0m0.122s user 0m0.024s sys 0m0.032s

The values are representative for several (>5) runs. Typical real times for Rust are ~15% lower than for C++.

The code is on the quick-benchmark branch: https://github.com/maximg/thrift/commit/9cde36a13aa5ed494a9923f6eeb6ca77b7cb1fdc, I will clean up and integrate it later today.

maximg avatar Jan 30 '15 07:01 maximg

Awesome news! Tell me if you need some help cleaning or rebasing it.

in-the-mood-for-mov avatar Feb 01 '15 16:02 in-the-mood-for-mov

Could you review the way I've added it to the transport? Feel free to adapt it if you think it should be a separate file.

https://github.com/maximg/thrift/commit/351dbe93609bc3784997c0be6484250a065e24a2

On Sun, Feb 1, 2015 at 5:56 PM, Simon Génier [email protected] wrote:

Awesome news! Tell me if you need some help cleaning or rebasing it.

— Reply to this email directly or view it on GitHub https://github.com/maximg/thrift/issues/9#issuecomment-72372611.

maximg avatar Feb 01 '15 18:02 maximg

Looks good! Nice to see that kind of improvement for such a small change.

I don't think it's worth creating a new module only for that, so I'd keep it in that file. Also, should we remove the Transport implementation for TcpStream so users don't make the same mistake as us and experience degraded performances?

in-the-mood-for-mov avatar Feb 01 '15 18:02 in-the-mood-for-mov

That's probably a good idea, we could add a comment that if for some reason there is a need to use raw tcp transport it can be done, but that it is not provided by default.

On Sun, Feb 1, 2015 at 7:34 PM, Simon Génier [email protected] wrote:

Looks good! Nice to see that kind of improvement for such a small change.

I don't think it's worth creating a new module only for that, so I'd keep it in that file. Also, should we remove the Transport implementation for TcpStream so users don't make the same mistake as us and experience degraded performances?

— Reply to this email directly or view it on GitHub https://github.com/maximg/thrift/issues/9#issuecomment-72377092.

maximg avatar Feb 01 '15 18:02 maximg

Should we close this issue for now and reopen if anything else comes up?

gsingh93 avatar Jun 08 '15 15:06 gsingh93

I think it is good to have it as a reminder before we go to main. Do you think we could use it to do performance measurements on the mutlithreaded server?

maximg avatar Jun 08 '15 20:06 maximg

A simple benchmark is available in tutorial/rs/src/benchmark.rs and tutorial/cpp/CppBenchmark.cpp

maximg avatar Jun 11 '15 18:06 maximg