Skip to content

Commit

Permalink
prealloc builder
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott committed Oct 29, 2024
1 parent 414ee9a commit f24c7b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/api/query_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func newQueryBuilder(init string) *queryBuilder {
builder: strings.Builder{},
}

qb.builder.Grow(100) // pre-allocate some space. ideally the caller could indicate roughly the expected size, but starting with 100 bytes significantly outperforms 0
qb.builder.WriteString(init)
return qb
}
Expand Down

0 comments on commit f24c7b6

Please sign in to comment.