Skip to content

Commit

Permalink
net/url: reduce allocs on resolvePath func
Browse files Browse the repository at this point in the history
pregrow result array to avoid small allocation.

Change-Id: Ife5f815efa4c163ecdbb3a4c16bfb60a484dfa11
Reviewed-on: https://go-review.googlesource.com/c/go/+/174706
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
Asuan authored and bradfitz committed Nov 8, 2019
1 parent 4692343 commit 3e5c043
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/net/url/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,8 @@ func resolvePath(base, ref string) string {
if full == "" {
return ""
}
var dst []string
src := strings.Split(full, "/")
dst := make([]string, 0, len(src))
for _, elem := range src {
switch elem {
case ".":
Expand Down

0 comments on commit 3e5c043

Please sign in to comment.