Reduce allocations
This commit is contained in:
parent
ddf87a7188
commit
21e05b2e27
1 changed files with 8 additions and 0 deletions
|
@ -93,6 +93,14 @@ func (d *Doc) UnmarshalJSON(data []byte) error {
|
|||
|
||||
func (d *Doc) path(path ...string) (paths []string) {
|
||||
|
||||
l := len(path)
|
||||
for _, p := range path {
|
||||
l += strings.Count(p, ".")
|
||||
l += strings.Count(p, "[")
|
||||
}
|
||||
|
||||
paths = make([]string, 0, l)
|
||||
|
||||
for _, p := range path {
|
||||
for j, i, o := 0, 0, false; i < len(p); i++ {
|
||||
switch {
|
||||
|
|
Loading…
Reference in a new issue