diff options
| author | Shulhan <m.shulhan@gmail.com> | 2024-10-26 00:48:33 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2026-02-03 18:04:30 +0700 |
| commit | 011e40da85bddf83fee0ded83cb9115b7a88b3d4 (patch) | |
| tree | 355cc352e66fc64ce94f17658c31e699aa798bb1 /src/internal | |
| parent | 85232e51b20971e0d211b25fa3aa412bc7987404 (diff) | |
| download | go-011e40da85bddf83fee0ded83cb9115b7a88b3d4.tar.xz | |
all: prealloc slice with possible minimum capabilities
Diffstat (limited to 'src/internal')
| -rw-r--r-- | src/internal/profile/profile.go | 2 | ||||
| -rw-r--r-- | src/internal/trace/traceviewer/mmu.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/internal/profile/profile.go b/src/internal/profile/profile.go index afd1dd72ee..c8529d916d 100644 --- a/src/internal/profile/profile.go +++ b/src/internal/profile/profile.go @@ -507,7 +507,7 @@ type Demangler func(name []string) (map[string]string, error) // it will silently preserve the original names in case of any errors. func (p *Profile) Demangle(d Demangler) error { // Collect names to demangle. - var names []string + names := make([]string, 0, len(p.Function)) for _, fn := range p.Function { names = append(names, fn.SystemName) } diff --git a/src/internal/trace/traceviewer/mmu.go b/src/internal/trace/traceviewer/mmu.go index 190ce5afca..3de3b7fc2c 100644 --- a/src/internal/trace/traceviewer/mmu.go +++ b/src/internal/trace/traceviewer/mmu.go @@ -385,7 +385,7 @@ func (m *mmu) HandleDetails(w http.ResponseWriter, r *http.Request) { worst := mmuCurve.Examples(time.Duration(window), 10) // Construct a link for each window. - var links []linkedUtilWindow + links := make([]linkedUtilWindow, 0, len(worst)) for _, ui := range worst { links = append(links, m.newLinkedUtilWindow(ui, time.Duration(window))) } |
