-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
protobuf: don't serialize zero-valued std duration #137479
Merged
craig
merged 2 commits into
cockroachdb:master
from
nvanbenschoten:nvanbenschoten/duration-alloc
Dec 16, 2024
Merged
protobuf: don't serialize zero-valued std duration #137479
craig
merged 2 commits into
cockroachdb:master
from
nvanbenschoten:nvanbenschoten/duration-alloc
Dec 16, 2024
Conversation
This file contains 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
RaduBerinde
approved these changes
Dec 14, 2024
tbg
approved these changes
Dec 16, 2024
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.
Reviewed 4 of 4 files at r1, 1 of 1 files at r2, 5 of 5 files at r3, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @nvanbenschoten)
This commit adds a pair of tests to measure the size of empty BatchRequest and BatchResponse messages when serialized. Epic: None Release note: None
nvanbenschoten
force-pushed
the
nvanbenschoten/duration-alloc
branch
from
December 16, 2024 16:04
d84db25
to
c647cdd
Compare
Picks up cockroachdb/gogoproto#10. > This commit updates the serialization of `time.Duration` (see > `gogo.stdduration`) to avoid serializing the default (zero) value in proto3. In > Go, `time.Duration` is a typedef of int64, so it was surprising that unlike > int64, the zero value of time.Duration fields were being put on the wire. > > While here, we also fix `DurationFromProto` to not cause its input to escape to > the heap by passing it through `fmt.Errorf`. This function is called from > `StdDurationUnmarshal` and its unintentional heap allocation what alerted me to > the zero-value serialization issue. Performance improvement on sysbench microbenchmarks: ``` name old time/op new time/op delta Sysbench/SQL/1node_remote/oltp_read_only-10 3.09ms ±12% 3.08ms ± 9% ~ (p=0.905 n=9+10) Sysbench/SQL/1node_remote/oltp_write_only-10 1.97ms ± 4% 1.96ms ± 3% ~ (p=0.278 n=9+10) Sysbench/SQL/1node_remote/oltp_read_write-10 5.73ms ± 1% 5.73ms ± 1% ~ (p=1.000 n=7+8) Sysbench/SQL/1node_remote/oltp_point_select-10 180µs ± 6% 181µs ±14% ~ (p=0.853 n=10+10) Sysbench/KV/1node_remote/oltp_read_only-10 736µs ± 3% 729µs ± 3% ~ (p=0.190 n=10+10) Sysbench/KV/1node_remote/oltp_write_only-10 594µs ± 2% 587µs ± 4% ~ (p=0.211 n=9+10) Sysbench/KV/1node_remote/oltp_read_write-10 1.44ms ± 6% 1.42ms ± 3% ~ (p=0.156 n=10+9) Sysbench/KV/1node_remote/oltp_point_select-10 33.7µs ±11% 34.9µs ± 9% ~ (p=0.247 n=10+10) name old alloc/op new alloc/op delta Sysbench/KV/1node_remote/oltp_point_select-10 6.69kB ± 1% 6.61kB ± 1% -1.18% (p=0.001 n=10+9) Sysbench/SQL/1node_remote/oltp_point_select-10 30.0kB ± 0% 29.7kB ± 1% -0.87% (p=0.000 n=8+10) Sysbench/SQL/1node_remote/oltp_write_only-10 476kB ± 0% 474kB ± 0% -0.61% (p=0.000 n=10+9) Sysbench/KV/1node_remote/oltp_write_only-10 230kB ± 0% 229kB ± 0% -0.53% (p=0.000 n=10+10) Sysbench/SQL/1node_remote/oltp_read_write-10 1.62MB ± 0% 1.62MB ± 0% -0.34% (p=0.000 n=10+10) Sysbench/KV/1node_remote/oltp_read_only-10 647kB ± 0% 645kB ± 0% -0.25% (p=0.000 n=10+10) Sysbench/KV/1node_remote/oltp_read_write-10 872kB ± 0% 870kB ± 0% -0.25% (p=0.000 n=10+9) Sysbench/SQL/1node_remote/oltp_read_only-10 1.15MB ± 0% 1.15MB ± 0% -0.23% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Sysbench/KV/1node_remote/oltp_point_select-10 57.0 ± 0% 55.0 ± 0% -3.51% (p=0.000 n=10+9) Sysbench/KV/1node_remote/oltp_read_only-10 1.83k ± 0% 1.80k ± 0% -1.54% (p=0.000 n=10+10) Sysbench/KV/1node_remote/oltp_read_write-10 3.33k ± 0% 3.29k ± 0% -1.43% (p=0.000 n=10+9) Sysbench/SQL/1node_remote/oltp_write_only-10 3.79k ± 0% 3.74k ± 0% -1.38% (p=0.000 n=10+9) Sysbench/KV/1node_remote/oltp_write_only-10 1.51k ± 0% 1.49k ± 0% -1.37% (p=0.000 n=10+10) Sysbench/SQL/1node_remote/oltp_read_write-10 8.40k ± 0% 8.31k ± 0% -1.13% (p=0.000 n=10+10) Sysbench/SQL/1node_remote/oltp_point_select-10 253 ± 0% 251 ± 1% -1.03% (p=0.000 n=10+10) Sysbench/SQL/1node_remote/oltp_read_only-10 4.60k ± 0% 4.56k ± 0% -0.89% (p=0.000 n=10+10) ``` Epic: None Release note: None
nvanbenschoten
force-pushed
the
nvanbenschoten/duration-alloc
branch
from
December 16, 2024 16:59
c647cdd
to
cabfad2
Compare
TFTRs! bors r+ |
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.
Picks up cockroachdb/gogoproto#10.
Performance improvement on sysbench microbenchmarks:
Epic: None
Release note: None