-
Notifications
You must be signed in to change notification settings - Fork 455
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
[WIP][DBNode] - Optimize Tag Encoder #1866
Conversation
@@ -156,42 +195,38 @@ func (e *encoder) Finalize() { | |||
p.Put(e) | |||
} | |||
|
|||
func (e *encoder) encodeTag(t ident.Tag) error { | |||
if len(t.Name.Bytes()) == 0 { | |||
func (e *encoder) encodeTag(name, value []byte) error { |
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.
Could also inline encodeTag I guess?
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.
Yeah I tried, didn’t get much benefit as far as I could tell
tags := srcTags.Duplicate() | ||
defer tags.Close() | ||
if sliceIter, ok := tagsIter.(interface { | ||
SliceIter() []ident.Tag |
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.
Does the commit log write path have a SliceIter that backs it? Or Is it only the tests that benefit from this speed up?
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.
Yeah it does I think unless I’m misunderstanding something: https://github.com/m3db/m3/blob/master/src/dbnode/persist/fs/commitlog/writer.go#L137
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 see, should we perhaps just make this another method, i.e. EncodeSlice(...)
or similar?
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 think the interface assertion is the cleanest personally (the assertion is very cheap since it only needs to check if one method exists) but we can add a new method if you feel strongly
Closing due to the change we merged instead #1898 |
No description provided.