]> Cypherpunks repositories - gostls13.git/commitdiff
debug/gosym: bulk allocate Syms
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 6 Oct 2021 19:40:35 +0000 (12:40 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 2 Nov 2021 18:24:18 +0000 (18:24 +0000)
name                old time/op    new time/op    delta
115/NewLineTable-8    80.7ns ± 1%    81.7ns ± 3%     ~     (p=0.408 n=10+8)
115/NewTable-8        76.3µs ± 2%    63.3µs ± 3%  -17.03%  (p=0.000 n=9+9)
115/LineToPC-8        56.8µs ± 2%    56.8µs ± 3%     ~     (p=0.905 n=10+9)
115/PCToLine-8         252ns ± 1%     256ns ± 5%     ~     (p=0.183 n=10+10)

name                old alloc/op   new alloc/op   delta
115/NewLineTable-8      384B ± 0%      384B ± 0%     ~     (all equal)
115/NewTable-8         164kB ± 0%     172kB ± 0%   +4.97%  (p=0.000 n=10+10)
115/LineToPC-8         0.00B          0.00B          ~     (all equal)
115/PCToLine-8         0.00B          0.00B          ~     (all equal)

name                old allocs/op  new allocs/op  delta
115/NewLineTable-8      3.00 ± 0%      3.00 ± 0%     ~     (all equal)
115/NewTable-8         1.04k ± 0%     0.01k ± 0%  -98.75%  (p=0.000 n=10+10)
115/LineToPC-8          0.00           0.00          ~     (all equal)
115/PCToLine-8          0.00           0.00          ~     (all equal)

Change-Id: Ibfe6c0cb86737dee8209cb1f58f5b796aa7b30aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/353134
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/debug/gosym/pclntab.go

index 134cb3d1948bcebccaea00b281f7327e60a4efbe..a687c406b2af83fd6735887dcb3e5c9fc045a649 100644 (file)
@@ -297,6 +297,7 @@ func (t *LineTable) go12Funcs() []Func {
 
        ft := t.funcTab()
        funcs := make([]Func, ft.Count())
+       syms := make([]Sym, len(funcs))
        for i := range funcs {
                f := &funcs[i]
                f.Entry = ft.pc(i)
@@ -304,13 +305,14 @@ func (t *LineTable) go12Funcs() []Func {
                info := t.funcData(uint32(i))
                f.LineTable = t
                f.FrameSize = int(info.deferreturn())
-               f.Sym = &Sym{
+               syms[i] = Sym{
                        Value:  f.Entry,
                        Type:   'T',
                        Name:   t.funcName(info.nameoff()),
                        GoType: 0,
                        Func:   f,
                }
+               f.Sym = &syms[i]
        }
        return funcs
 }