-
Notifications
You must be signed in to change notification settings - Fork 806
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
Eliminate intermediate allocs when using StdTime/StdDuration #509
Open
timpalpant
wants to merge
14
commits into
gogo:master
Choose a base branch
from
timpalpant:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
Having looked at more of the code, do we want to even keep this as a |
… types and either call Compare if they are the same or return 1/-1. (gogo#600)
…5eaa - protoc-gen-go: generate XXX_OneofWrappers instead of XXX_OneofFuncs (gogo#613)
* libprotoc: update to version 3.9.1 * libprotoc: update travis protoc version to 3.9.1
Fixes gogo#617 Adds test which generates a marshalTo for a oneof message. This will fail to compile if the wrong size method is generated in the marshalTo method.
…c90f - Log parsing errors using log pkg
…bf7 - jsonpb: fix marshaling of Duration
…f25b - all: fix reflect.Value.Interface races.
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.
When using StdTime/StdDuration, we incur unnecessary allocations due to the use of an intermediate
*Timestamp
/*Duration
that escapes to the heap from a potential call tofmt.Errorf
. This can be seen in:This is a major source of GC pressure for me (see also #254). This change eliminates the potential escape by introducing two small functions
formatTimestamp
andformatDuration
to perform the equivalent formatting (for these specific cases) instead of usingfmt.Errorf
.There are tests added to verify the equivalence, as well as to verify zero allocs in
SizeOf
,MarshalTo
, andUnmarshal
for both StdTime and StdDuration.