1. 24 Apr, 2018 4 commits
    • Ian Lance Taylor's avatar
      runtime: change GNU/Linux usleep to use nanosleep · 665b9b34
      Ian Lance Taylor authored
      Ever since we added sleep to the runtime back in 2008, we've
      implemented it on GNU/Linux with the select (or pselect or pselect6)
      system call. But the Linux kernel has a nanosleep system call,
      which should be a tiny bit more efficient since it doesn't have to
      check to see whether there are any file descriptors. So use it.
      
      Change-Id: Icc3430baca46b082a4d33f97c6c47e25fa91cb9a
      Reviewed-on: https://go-review.googlesource.com/108538
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      665b9b34
    • Matthew Dempsky's avatar
      cmd/compile: enable indexed export format by default · a3c75d9b
      Matthew Dempsky authored
      Change-Id: Id018eeb79afbe2c695a583b3845cfbc1aab08388
      Reviewed-on: https://go-review.googlesource.com/106797
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      a3c75d9b
    • Matthew Dempsky's avatar
      cmd/compile: add indexed export format · ca2f85fd
      Matthew Dempsky authored
      This CL introduces a new indexed data format for package export
      data. This improves on the previous (sequential) binary format by
      allowing the compiler to selectively (and lazily) load only the data
      that's actually needed for compilation.
      
      In large Go projects, the package export data can become very large
      due to transitive type declaration dependencies and inline
      function/method bodies. By lazily loading these declarations and
      bodies as needed, we avoid wasting time and memory processing
      unnecessary and/or redundant data.
      
      In the benchmarks below, "old" is -iexport=false and "new" is
      -iexport=true. The suffixes indicate the compiler concurrency (-c) and
      inlining (-l) settings used for the build (using -gcflags=all=-foo).
      Benchmarks were run on an HP Z620.
      
      Juju is "go build -a github.com/juju/juju/cmd/...":
      
      name          old real-time/op  new real-time/op  delta
      Juju/c=1/l=0        44.0s ± 1%        38.7s ± 9%  -11.97%  (p=0.001 n=7+7)
      Juju/c=1/l=4        53.7s ± 3%        45.3s ± 4%  -15.53%  (p=0.001 n=7+7)
      Juju/c=4/l=0        39.7s ± 8%        32.0s ± 4%  -19.38%  (p=0.001 n=7+7)
      Juju/c=4/l=4        46.3s ± 4%        38.0s ± 4%  -18.06%  (p=0.001 n=7+7)
      
      name          old user-time/op  new user-time/op  delta
      Juju/c=1/l=0         371s ± 1%         300s ± 0%  -19.07%  (p=0.001 n=7+6)
      Juju/c=1/l=4         482s ± 0%         374s ± 1%  -22.37%  (p=0.001 n=7+7)
      Juju/c=4/l=0         410s ± 1%         340s ± 1%  -17.19%  (p=0.001 n=7+7)
      Juju/c=4/l=4         532s ± 1%         424s ± 1%  -20.26%  (p=0.001 n=7+7)
      
      name          old sys-time/op   new sys-time/op   delta
      Juju/c=1/l=0        33.4s ± 1%        28.4s ± 2%  -15.02%  (p=0.001 n=7+7)
      Juju/c=1/l=4        40.7s ± 2%        32.8s ± 3%  -19.51%  (p=0.001 n=7+7)
      Juju/c=4/l=0        39.8s ± 2%        34.4s ± 2%  -13.74%  (p=0.001 n=7+7)
      Juju/c=4/l=4        48.4s ± 2%        40.4s ± 2%  -16.50%  (p=0.001 n=7+7)
      
      Kubelet is "go build -a k8s.io/kubernetes/cmd/kubelet":
      
      name             old real-time/op  new real-time/op  delta
      Kubelet/c=1/l=0        42.0s ± 1%        34.8s ± 1%  -17.27%  (p=0.008 n=5+5)
      Kubelet/c=1/l=4        55.4s ± 3%        45.4s ± 3%  -18.06%  (p=0.002 n=6+6)
      Kubelet/c=4/l=0        37.4s ± 3%        29.9s ± 1%  -20.25%  (p=0.004 n=6+5)
      Kubelet/c=4/l=4        48.1s ± 2%        39.0s ± 5%  -18.93%  (p=0.002 n=6+6)
      
      name             old user-time/op  new user-time/op  delta
      Kubelet/c=1/l=0         291s ± 1%         233s ± 1%  -19.96%  (p=0.002 n=6+6)
      Kubelet/c=1/l=4         385s ± 1%         298s ± 1%  -22.51%  (p=0.002 n=6+6)
      Kubelet/c=4/l=0         325s ± 0%         268s ± 1%  -17.48%  (p=0.004 n=5+6)
      Kubelet/c=4/l=4         429s ± 1%         343s ± 1%  -20.08%  (p=0.002 n=6+6)
      
      name             old sys-time/op   new sys-time/op   delta
      Kubelet/c=1/l=0        25.1s ± 2%        20.9s ± 4%  -16.69%  (p=0.002 n=6+6)
      Kubelet/c=1/l=4        31.2s ± 3%        24.4s ± 0%  -21.67%  (p=0.010 n=6+4)
      Kubelet/c=4/l=0        30.2s ± 2%        25.6s ± 1%  -15.34%  (p=0.002 n=6+6)
      Kubelet/c=4/l=4        37.3s ± 1%        30.9s ± 2%  -17.11%  (p=0.002 n=6+6)
      
      Change-Id: Ie43eb3bbe1392cbb61c86792a17a57b33b9561f0
      Reviewed-on: https://go-review.googlesource.com/106796
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      ca2f85fd
    • Matthew Dempsky's avatar
      cmd/compile/internal/types: add Pkg and SetPkg methods to Type · 03f546eb
      Matthew Dempsky authored
      The go/types API exposes what package objects were declared in, which
      includes struct fields, interface methods, and function parameters.
      
      The compiler implicitly tracks these for non-exported identifiers
      (through the Sym's associated Pkg), but exported identifiers always
      use localpkg. To simplify identifying this, add an explicit package
      field to struct, interface, and function types.
      
      Change-Id: I6adc5dc653e78f058714259845fb3077066eec82
      Reviewed-on: https://go-review.googlesource.com/107622Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      03f546eb
  2. 23 Apr, 2018 10 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: rewrite 2*x+c into LEAx1 on amd64 · d292f77e
      Josh Bleecher Snyder authored
      Rewrite x<<1+c into x+x+c, which can be expressed as a single LEAQ/LEAL.
      
      Bit of a special case, but the single-instruction
      LEA is both shorter and faster than SHL then ADD.
      
      Triggers 293 times during make.bash.
      
      Change-Id: I3f09c8e9a8f3859d1eeed336f095fc3ada79c2c1
      Reviewed-on: https://go-review.googlesource.com/108938
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      d292f77e
    • Rodolfo Carvalho's avatar
      doc: correct statement in go1.10 release notes · c0769741
      Rodolfo Carvalho authored
      The language spec requires the RHS operand of shift expressions to be unsigned integers.
      
      The changes in CL 60230 and the related CL 81277 refer to a variable s of type uint.
      The "untyped constant" here refers to 1.0, not s.
      
      Change-Id: Id2b884816af7f79f453afcb8c34ade2d34e18bc2
      GitHub-Last-Rev: b26c853cae2adea7235a51ad726308e337494385
      GitHub-Pull-Request: golang/go#24989
      Reviewed-on: https://go-review.googlesource.com/108676Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      c0769741
    • Josh Bleecher Snyder's avatar
      cmd/compile: add amd64 LEAL{1,2,4,8} ops · 22115859
      Josh Bleecher Snyder authored
      For future use in rewrite rules.
      
      Change-Id: Ic9875beb0dea6e0bbcbd4b75d99a53f4a9a7c3fd
      Reviewed-on: https://go-review.googlesource.com/101275
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      22115859
    • isharipo's avatar
      cmd/internal/obj/x86: faster Assemble for non-NaCl hosts · 8e3dd8ab
      isharipo authored
      Make span6 function (used as LinkArch.Assemble) faster
      by avoiding redundant re-assemble rounds on hosts
      that are not NaCl.
      
      NaCl is excluded because it needs Prog.Isize to fix alignment.
      
      For make.bash, there are around 50% of functions that can
      be encoded in a single trip. With this change, those function
      will be assembled with 1 round instead of 2.
      
      compilebench results:
      
          name        old time/op       new time/op       delta
          Template          305ms ± 2%        299ms ± 2%  -1.99%  (p=0.001 n=10+10)
          Unicode           139ms ± 3%        138ms ± 4%    ~     (p=0.222 n=9+9)
          GoTypes           1.05s ± 1%        1.04s ± 1%  -1.34%  (p=0.000 n=10+9)
          Compiler          4.78s ± 1%        4.71s ± 1%  -1.45%  (p=0.000 n=9+9)
          SSA               12.2s ± 1%        12.0s ± 1%  -1.90%  (p=0.000 n=9+10)
          Flate             204ms ± 3%        202ms ± 3%    ~     (p=0.052 n=10+10)
          GoParser          248ms ± 1%        244ms ± 2%  -1.79%  (p=0.000 n=10+9)
          Reflect           671ms ± 1%        664ms ± 1%  -0.96%  (p=0.001 n=9+9)
          Tar               287ms ± 2%        285ms ± 3%    ~     (p=0.393 n=10+10)
          XML               362ms ± 1%        353ms ± 2%  -2.60%  (p=0.000 n=10+9)
          StdCmd            29.2s ± 1%        29.0s ± 1%  -0.63%  (p=0.021 n=10+8)
          [Geo mean]        888ms             875ms       -1.40%
      
          name        old user-time/op  new user-time/op  delta
          Template          393ms ± 5%        373ms ± 8%  -5.12%  (p=0.013 n=9+10)
          Unicode           185ms ± 6%        184ms ± 5%    ~     (p=0.825 n=10+10)
          GoTypes           1.33s ± 1%        1.31s ± 3%  -1.60%  (p=0.004 n=10+10)
          Compiler          5.98s ± 3%        5.92s ± 1%    ~     (p=0.050 n=10+10)
          SSA               15.5s ± 2%        15.3s ± 0%    ~     (p=0.156 n=10+9)
          Flate             255ms ± 5%        252ms ± 5%    ~     (p=0.362 n=10+10)
          GoParser          309ms ± 1%        304ms ± 3%  -1.79%  (p=0.021 n=7+10)
          Reflect           839ms ± 2%        833ms ± 1%    ~     (p=0.160 n=10+9)
          Tar               363ms ± 3%        358ms ± 4%    ~     (p=0.194 n=8+10)
          XML               446ms ± 3%        442ms ± 3%    ~     (p=0.503 n=10+10)
          [Geo mean]        791ms             779ms       -1.55%
      
      Passes toolstash-check.
      
      Change-Id: Ibcdb09f2c28907932581b7566f46d34be292594b
      Reviewed-on: https://go-review.googlesource.com/108895
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      8e3dd8ab
    • ludweeg's avatar
      crypto: make receiver name consistent · 0cd0dc96
      ludweeg authored
      Fixes go lint warning.
      
      Change-Id: I63950e7c70bf431e88a04f32befd50be9beacadf
      Reviewed-on: https://go-review.googlesource.com/108815Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0cd0dc96
    • Matthew Dempsky's avatar
      cmd/compile: remove toolstash workaround in bexport.go · 545ef110
      Matthew Dempsky authored
      Change-Id: Ie4facdcab4b35cf7d350c4b8fa06a3c5a0c6caeb
      Reviewed-on: https://go-review.googlesource.com/108875
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      545ef110
    • Matthew Dempsky's avatar
      cmd/compile: replace Field.Nname.Pos with Field.Pos · 7759b32a
      Matthew Dempsky authored
      For struct fields and methods, Field.Nname was only used to store
      position information, which means we're allocating an entire ONAME
      Node+Name+Param structure just for one field. We can optimize away
      these ONAME allocations by instead adding a Field.Pos field.
      
      Unfortunately, we can't get rid of Field.Nname, because it's needed
      for function parameters, so Field grows a little bit and now has more
      redundant information in those cases. However, that was already the
      case (e.g., Field.Sym and Field.Nname.Sym), and it's still a net win
      for allocations as demonstrated by the benchmarks below.
      
      Additionally, by moving the ONAME allocation for function parameters
      to funcargs, we can avoid allocating them for function parameters that
      aren't used in corresponding function bodies (e.g., interface methods,
      function-typed variables, and imported functions/methods without
      inline bodies).
      
      name       old time/op       new time/op       delta
      Template         254ms ± 6%        251ms ± 6%  -1.04%  (p=0.000 n=487+488)
      Unicode          128ms ± 7%        128ms ± 7%    ~     (p=0.294 n=482+467)
      GoTypes          862ms ± 5%        860ms ± 4%    ~     (p=0.075 n=488+471)
      Compiler         3.91s ± 4%        3.90s ± 4%  -0.39%  (p=0.000 n=468+473)
      
      name       old user-time/op  new user-time/op  delta
      Template         339ms ±14%        336ms ±14%  -1.02%  (p=0.001 n=498+494)
      Unicode          176ms ±18%        176ms ±25%    ~     (p=0.940 n=491+499)
      GoTypes          1.13s ± 8%        1.13s ± 9%    ~     (p=0.157 n=496+493)
      Compiler         5.24s ± 6%        5.21s ± 6%  -0.57%  (p=0.000 n=485+489)
      
      name       old alloc/op      new alloc/op      delta
      Template        38.3MB ± 0%       37.3MB ± 0%  -2.58%  (p=0.000 n=499+497)
      Unicode         29.1MB ± 0%       29.1MB ± 0%  -0.03%  (p=0.000 n=500+493)
      GoTypes          116MB ± 0%        115MB ± 0%  -0.65%  (p=0.000 n=498+499)
      Compiler         492MB ± 0%        487MB ± 0%  -1.00%  (p=0.000 n=497+498)
      
      name       old allocs/op     new allocs/op     delta
      Template          364k ± 0%         360k ± 0%  -1.15%  (p=0.000 n=499+499)
      Unicode           336k ± 0%         336k ± 0%  -0.01%  (p=0.000 n=500+493)
      GoTypes          1.16M ± 0%        1.16M ± 0%  -0.30%  (p=0.000 n=499+499)
      Compiler         4.54M ± 0%        4.51M ± 0%  -0.58%  (p=0.000 n=494+495)
      
      Passes toolstash-check -gcflags=-dwarf=false. Changes DWARF output
      because position information is now tracked more precisely for
      function parameters.
      
      Change-Id: Ib8077d70d564cc448c5e4290baceab3a4396d712
      Reviewed-on: https://go-review.googlesource.com/108217
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      7759b32a
    • Austin Clements's avatar
      cmd/compile: don't compact liveness maps in place · bdb65da0
      Austin Clements authored
      Currently Liveness.compact rewrites the Liveness.livevars slice in
      place. However, we're about to add register maps, which we'll want to
      track in livevars, but compact independently from the stack maps.
      Hence, this CL modifies Liveness.compact to consume Liveness.livevars
      and produce a new slice of deduplicated stack maps. This is somewhat
      clearer anyway because it avoids potential confusion over how
      Liveness.livevars is indexed.
      
      Passes toolstash -cmp.
      
      For #24543.
      
      Change-Id: I7093fbc71143f8a29e677aa30c96e501f953ca2b
      Reviewed-on: https://go-review.googlesource.com/108498
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      bdb65da0
    • Elias Naur's avatar
      cmd/link: remove R_ADDR relocation workaround for macho arm64 · 3363e983
      Elias Naur authored
      The workarounds doesn't seem necessary anymore, and blocks DWARF
      on darwin/arm64.
      
      Updates #24883.
      
      Change-Id: Ic917c767d3b4f6c51be25566956296f5dd4ead10
      Reviewed-on: https://go-review.googlesource.com/108655
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      3363e983
    • ludweeg's avatar
      crypto/md5: make receiver name consistent · 1f718926
      ludweeg authored
      Fixes go lint warning.
      
      Change-Id: I2d73208c6841f35d7a21a1fb4cfafbbd4250228f
      Reviewed-on: https://go-review.googlesource.com/108659Reviewed-by: 's avatarIskander Sharipov <iskander.sharipov@intel.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1f718926
  3. 22 Apr, 2018 2 commits
  4. 21 Apr, 2018 6 commits
  5. 20 Apr, 2018 18 commits