-
Notifications
You must be signed in to change notification settings - Fork 321
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
Make it more efficient and compatible to use SampleHistogram #439
Make it more efficient and compatible to use SampleHistogram #439
Conversation
Store SampleHistogram in SampleHistogramPair as pointer. More compatible with what protobuf generates. More efficient when taking the histogram from the pair. Simpler test code. Signed-off-by: György Krajcsovits <[email protected]>
@@ -135,7 +135,7 @@ func (s *SampleHistogram) Equal(o *SampleHistogram) bool { | |||
|
|||
type SampleHistogramPair struct { | |||
Timestamp Time | |||
Histogram SampleHistogram | |||
Histogram *SampleHistogram |
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.
Worth commenting that it should never be nil
and it is as a pointer for efficiency.
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.
should MarshalJSON check that it's nil and error out if it is?
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.
I've ended up convincing myself to error on nil
histogram, to avoid ever generating invalid JSON from this
Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
Signed-off-by: György Krajcsovits <[email protected]>
Co-authored-by: Ganesh Vernekar <[email protected]> Signed-off-by: George Krajcsovits <[email protected]>
…eus#439) Store SampleHistogram in SampleHistogramPair as pointer. More compatible with what protobuf generates. More efficient when taking the histogram from the pair. Simpler test code. Signed-off-by: György Krajcsovits <[email protected]> Signed-off-by: George Krajcsovits <[email protected]> Co-authored-by: Ganesh Vernekar <[email protected]>
Store SampleHistogram in SampleHistogramPair as pointer.
More compatible with what protobuf generates.
More efficient when taking the histogram from the pair.
Simpler test code.
Signed-off-by: György Krajcsovits [email protected]