Commit dc46b882 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: stop allocating Name and Param for ODCLFIELD

name       old time/op     new time/op     delta
Template       349ms ± 5%      339ms ± 7%  -2.89%        (p=0.000 n=27+29)
Unicode        187ms ±11%      182ms ±11%  -2.77%        (p=0.039 n=29+29)
GoTypes        1.05s ± 3%      1.04s ± 4%    ~           (p=0.103 n=29+29)
Compiler       4.57s ± 3%      4.55s ± 3%    ~           (p=0.202 n=30+29)

name       old user-ns/op  new user-ns/op  delta
Template        510M ±21%       521M ±18%    ~           (p=0.281 n=30+29)
Unicode         303M ±34%       300M ±28%    ~           (p=0.592 n=30+30)
GoTypes        1.52G ± 9%      1.50G ± 9%    ~           (p=0.314 n=30+30)
Compiler       6.50G ± 5%      6.44G ± 5%    ~           (p=0.362 n=29+30)

name       old alloc/op    new alloc/op    delta
Template      44.7MB ± 0%     44.0MB ± 0%  -1.63%        (p=0.000 n=28+28)
Unicode       34.6MB ± 0%     34.5MB ± 0%  -0.18%        (p=0.000 n=30+29)
GoTypes        125MB ± 0%      123MB ± 0%  -1.14%        (p=0.000 n=30+30)
Compiler       515MB ± 0%      513MB ± 0%  -0.52%        (p=0.000 n=30+30)

name       old allocs/op   new allocs/op   delta
Template        427k ± 0%       416k ± 0%  -2.66%        (p=0.000 n=30+30)
Unicode         323k ± 0%       322k ± 0%  -0.28%        (p=0.000 n=30+30)
GoTypes        1.21M ± 0%      1.18M ± 0%  -1.84%        (p=0.000 n=29+30)
Compiler       4.40M ± 0%      4.36M ± 0%  -0.95%        (p=0.000 n=30+30)

Passes toolstash -cmp.

Change-Id: Ifee7d012b1cddadda01450e027eef8d4ecf5581f
Reviewed-on: https://go-review.googlesource.com/30980
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 01bf5cc2
......@@ -367,13 +367,6 @@ func nod(op Op, nleft *Node, nright *Node) *Node {
n.Name.Param = new(Param)
case OLABEL, OPACK:
n.Name = new(Name)
case ODCLFIELD:
if nleft != nil {
n.Name = nleft.Name
} else {
n.Name = new(Name)
n.Name.Param = new(Param)
}
}
if n.Name != nil {
n.Name.Curfn = Curfn
......
......@@ -165,7 +165,7 @@ func (n *Node) SetOpt(x interface{}) {
n.E = x
}
// Name holds Node fields used only by named nodes (ONAME, OPACK, OLABEL, ODCLFIELD, some OLITERAL).
// Name holds Node fields used only by named nodes (ONAME, OPACK, OLABEL, some OLITERAL).
type Name struct {
Pack *Node // real package for import . names
Pkg *Pkg // pkg for OPACK nodes
......@@ -173,7 +173,7 @@ type Name struct {
Inlvar *Node // ONAME substitute while inlining (could move to Param?)
Defn *Node // initializing assignment
Curfn *Node // function for local variables
Param *Param // additional fields for ONAME, ODCLFIELD
Param *Param // additional fields for ONAME
Decldepth int32 // declaration loop depth, increased for every loop or label
Vargen int32 // unique name for ONAME within a function. Function outputs are numbered starting at one.
Iota int32 // value if this name is iota
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment