-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
server: skip unnecessary sprintf which executes proto.Size() #13075
Conversation
0dde64f
to
4b58d64
Compare
Codecov Report
@@ Coverage Diff @@
## main #13075 +/- ##
==========================================
+ Coverage 61.68% 64.48% +2.80%
==========================================
Files 435 438 +3
Lines 34010 34057 +47
==========================================
+ Hits 20978 21962 +984
+ Misses 10953 9999 -954
- Partials 2079 2096 +17
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I thought maybe it is worth adding some benchmarks? Something as simple as:
Gives:
and
|
@wilsonwang371 Thanks. Can we add the benchmark from @nekto0n as well? |
@wilsonwang371 Let's add that benchmark case for future reference, otherwise LGTM. Thanks. |
c7f8cc1
to
7ffe1f3
Compare
7ffe1f3
to
11edc76
Compare
Just added the benchmark code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm thanks.
@wilsonwang371 Can you help with back porting to 3.5 as well? /cc @hexfusion |
I posted backport pull request #13081 |
From the profiling, I saw that when we call proto.Size(), it will unmarshal the data and return the size, which is costly. Similar to what we got in #12871
To avoid unnecessary proto.Size() call, I created this patch.
Some initial evaluation looks good. More data generating is in progress. It can increase the throughput by around 10% when we have small data size and a large number of requests.
@gyuho @ptabor