From 3e5c04313c28e463fa866c2ef669ed66628faf9b Mon Sep 17 00:00:00 2001 From: sergey Date: Thu, 2 May 2019 18:07:34 +0300 Subject: [PATCH] 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/+/174706 Reviewed-by: Brad Fitzpatrick --- src/net/url/url.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/url/url.go b/src/net/url/url.go index 6f4d5a1ce77..6480d4b4322 100644 --- a/src/net/url/url.go +++ b/src/net/url/url.go @@ -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 ".":