Skip to content

Commit

Permalink
Merge pull request influxdata#2207 from influxdata/fix/small-mem-opti…
Browse files Browse the repository at this point in the history
…mization

avoid allocation when building group ID
  • Loading branch information
nathanielc authored May 1, 2019
2 parents 9ba7bc6 + 76a8826 commit 72e88b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [#2144](https://github.com/influxdata/kapacitor/issues/2144): Fix deadlock in barrier node when delete is used.
- [#2186](https://github.com/influxdata/kapacitor/pull/2186): Make RPM create files with correct ownership on install.
- [#2189](https://github.com/influxdata/kapacitor/pull/2189): Delete group stats when a group is deleted
- [#2207](https://github.com/influxdata/kapacitor/pull/2207): Avoid extra allocation when building GroupID

## v1.5.2 [2018-12-12]

Expand Down
6 changes: 3 additions & 3 deletions models/point.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package models

import (
"bytes"
"sort"
"strings"
)

type GroupID string
Expand Down Expand Up @@ -86,7 +86,7 @@ func ToGroupID(name string, tags map[string]string, dims Dimensions) GroupID {
}
return NilGroup
}
var buf bytes.Buffer
var buf strings.Builder
if dims.ByName {
buf.WriteString(name)
// Add delimiter that is not allowed in name.
Expand All @@ -101,5 +101,5 @@ func ToGroupID(name string, tags map[string]string, dims Dimensions) GroupID {
buf.WriteString(tags[d])

}
return GroupID(buf.Bytes())
return GroupID(buf.String())
}

0 comments on commit 72e88b9

Please sign in to comment.