Commit 3e5c0431 authored by sergey's avatar sergey Committed by Brad Fitzpatrick

net/url: reduce allocs on resolvePath func

pregrow result array to avoid small allocation.

Change-Id: Ife5f815efa4c163ecdbb3a4c16bfb60a484dfa11
Reviewed-on: https://go-review.googlesource.com/c/go/+/174706Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 4692343c
...@@ -950,8 +950,8 @@ func resolvePath(base, ref string) string { ...@@ -950,8 +950,8 @@ func resolvePath(base, ref string) string {
if full == "" { if full == "" {
return "" return ""
} }
var dst []string
src := strings.Split(full, "/") src := strings.Split(full, "/")
dst := make([]string, 0, len(src))
for _, elem := range src { for _, elem := range src {
switch elem { switch elem {
case ".": case ".":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment