mirror of
https://github.com/golang/go
synced 2024-11-23 14:40:02 -07:00
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 <bradfitz@golang.org>
This commit is contained in:
parent
4692343cf4
commit
3e5c04313c
@ -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 ".":
|
||||
|
Loading…
Reference in New Issue
Block a user