Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

richardartoul
Copy link
Contributor

No description provided.

Richard Artoul added 2 commits August 8, 2019 17:23
@@ -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 {
Copy link
Collaborator

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?

Copy link
Contributor Author

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
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

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?

Copy link
Contributor Author

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

@robskillington
Copy link
Collaborator

Closing due to the change we merged instead #1898

@justinjc justinjc deleted the ra/optimize-tag-encoder branch May 14, 2020 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants