Skip to content

Commit 63adf47

Browse files
qmuntalgopherbot
authored andcommitted
internal/gosym: preallocate inlined call slice
LineTable.InlineTree allocates a slice whose length is known in advance. Preallocate it to avoid reallocations. Change-Id: I1939f6d4e956ccb5d2b68e10695622784d8ced38 Reviewed-on: https://go-review.googlesource.com/c/vuln/+/581135 Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Joedian Reid <joedian@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
1 parent 230480c commit 63adf47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/gosym/additions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (t *LineTable) InlineTree(f *Func, goFuncValue, baseAddr uint64, progReader
6060
}
6161

6262
r := io.NewSectionReader(progReader, offset, 1<<32) // pick a size larger than we need
63-
var ics []InlinedCall
63+
ics := make([]InlinedCall, 0, f.inlineTreeCount)
6464
for i := 0; i < f.inlineTreeCount; i++ {
6565
if t.version >= ver120 {
6666
var ric rawInlinedCall120

0 commit comments

Comments
 (0)