1. 19 Mar, 2017 6 commits
    • Martin Möhrmann's avatar
      cmd/compile: reduce allocs when appending to Node slices · 00f4cacb
      Martin Möhrmann authored
      Rewrite Append function such that the *Node slice argument does not escape.
      
      Passes toolstash -cmp.
      
      name      old alloc/op    new alloc/op    delta
      Template     40.8MB ± 0%     40.8MB ± 0%  -0.17%  (p=0.000 n=20+19)
      Unicode      30.3MB ± 0%     30.2MB ± 0%  -0.11%  (p=0.000 n=19+20)
      GoTypes       115MB ± 0%      115MB ± 0%  -0.20%  (p=0.000 n=20+20)
      Compiler      492MB ± 0%      491MB ± 0%  -0.25%  (p=0.000 n=20+20)
      SSA           858MB ± 0%      858MB ± 0%  -0.08%  (p=0.000 n=20+20)
      Flate        26.2MB ± 0%     26.2MB ± 0%  -0.13%  (p=0.000 n=20+19)
      GoParser     32.5MB ± 0%     32.4MB ± 0%  -0.14%  (p=0.000 n=20+20)
      Reflect      80.6MB ± 0%     80.4MB ± 0%  -0.27%  (p=0.000 n=20+20)
      Tar          27.3MB ± 0%     27.3MB ± 0%  -0.12%  (p=0.000 n=20+19)
      XML          43.1MB ± 0%     43.0MB ± 0%  -0.14%  (p=0.000 n=20+20)
      
      name      old allocs/op   new allocs/op   delta
      Template       400k ± 1%       397k ± 0%  -0.81%  (p=0.000 n=20+18)
      Unicode        321k ± 1%       320k ± 0%  -0.43%  (p=0.000 n=20+20)
      GoTypes       1.17M ± 0%      1.16M ± 0%  -0.89%  (p=0.000 n=20+20)
      Compiler      4.59M ± 0%      4.54M ± 0%  -1.26%  (p=0.000 n=20+19)
      SSA           7.68M ± 0%      7.65M ± 0%  -0.37%  (p=0.000 n=18+18)
      Flate          242k ± 1%       240k ± 1%  -0.70%  (p=0.000 n=20+20)
      GoParser       323k ± 1%       321k ± 1%  -0.64%  (p=0.000 n=20+20)
      Reflect       1.01M ± 0%      1.00M ± 0%  -0.92%  (p=0.000 n=20+19)
      Tar            258k ± 1%       256k ± 1%  -0.60%  (p=0.000 n=20+19)
      XML            403k ± 1%       400k ± 0%  -0.78%  (p=0.000 n=20+20)
      
      Change-Id: Ie1eb603dc46f729574f6a76c08085b2619249be4
      Reviewed-on: https://go-review.googlesource.com/37437Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      00f4cacb
    • Michel Lespinasse's avatar
      cmd/pprof: use proxy from environment · 81bcc470
      Michel Lespinasse authored
      See #18736
      
      Change-Id: I9c16357c05c16db677125d3077ee466b71559c7a
      Reviewed-on: https://go-review.googlesource.com/38343Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      81bcc470
    • Josh Bleecher Snyder's avatar
      cmd/compile: clean up SSA test API · a68e5d94
      Josh Bleecher Snyder authored
      I noted in CL 38327 that the SSA test API felt a bit
      clunky after the ssa.Func/ssa.Cache/ssa.Config refactoring,
      and promised to clean it up once the dust settled.
      The dust has settled.
      
      Along the way, this CL fixes a potential latent bug,
      in which the amd64 test context was used for all dummy Syslook calls.
      The lone SSA test using the s390x context did not depend on the
      Syslook context being correct, so the bug did not arise in practice.
      
      Change-Id: If964251d1807976073ad7f47da0b1f1f77c58413
      Reviewed-on: https://go-review.googlesource.com/38346
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      a68e5d94
    • Josh Bleecher Snyder's avatar
      cmd/compile: canonicalize empty interface types · 62947bed
      Josh Bleecher Snyder authored
      Mapping all empty interfaces onto the same Type
      allows better reuse of the ptrTo and sliceOf
      Type caches for *interface{} and []interface{}.
      
      This has little compiler performance impact now,
      but it will be helpful in the future,
      when we will eagerly populate some of those caches.
      
      Passes toolstash-check.
      
      Change-Id: I17daee599a129b0b2f5f3025c1be43d569d6782c
      Reviewed-on: https://go-review.googlesource.com/38344
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      62947bed
    • Josh Bleecher Snyder's avatar
      cmd/compile: add more types to ssa.Types · 872db799
      Josh Bleecher Snyder authored
      This reduces the number of calls back into the
      gc Type routines, which will help performance
      in a concurrent backend.
      It also reduces the number of callsites
      that must be considered in making the transition.
      
      Passes toolstash-check -all. No compiler performance changes.
      
      Updates #15756
      
      Change-Id: Ic7a8f1daac7e01a21658ae61ac118b2a70804117
      Reviewed-on: https://go-review.googlesource.com/38340
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      872db799
    • Josh Bleecher Snyder's avatar
      cmd/compile: separate ssa.Frontend and ssa.TypeSource · aea3aff6
      Josh Bleecher Snyder authored
      Prior to this CL, the ssa.Frontend field was responsible
      for providing types to the backend during compilation.
      However, the types needed by the backend are few and static.
      It makes more sense to use a struct for them
      and to hang that struct off the ssa.Config,
      which is the correct home for readonly data.
      Now that Types is a struct, we can clean up the names a bit as well.
      
      This has the added benefit of allowing early construction
      of all types needed by the backend.
      This will be useful for concurrent backend compilation.
      
      Passes toolstash-check -all. No compiler performance change.
      
      Updates #15756
      
      Change-Id: I021658c8cf2836d6a22bbc20cc828ac38c7da08a
      Reviewed-on: https://go-review.googlesource.com/38336Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      aea3aff6
  2. 18 Mar, 2017 4 commits
  3. 17 Mar, 2017 26 commits
  4. 16 Mar, 2017 4 commits
    • Jeremy Jackins's avatar
      cmd/compile: further clarify assignment count mismatch error message · 73a44f04
      Jeremy Jackins authored
      This is an evolution of https://go-review.googlesource.com/33616, as discussed
      via email with Robert (gri):
      
      $ cat foobar.go
      package main
      
      func main() {
              a := "foo", "bar"
      }
      
      before:
      ./foobar.go:4:4: assignment count mismatch: want 1 values, got 2
      
      after:
      ./foobar.go:4:4: assignment count mismatch: cannot assign 2 values to 1 variables
      
      We could likely also eliminate the "assignment count mismatch" prefix now
      without losing any information, but that string is matched by a number of
      tests.
      
      Change-Id: Ie6fc8a7bbd0ebe841d53e66e5c2f49868decf761
      Reviewed-on: https://go-review.googlesource.com/38313Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      73a44f04
    • Keith Randall's avatar
      cmd/compile: intrinsics for math/bits.{Len,LeadingZeros} · 495b1679
      Keith Randall authored
      name              old time/op  new time/op  delta
      LeadingZeros-4    2.00ns ± 0%  1.34ns ± 1%  -33.02%  (p=0.000 n=8+10)
      LeadingZeros16-4  1.62ns ± 0%  1.57ns ± 0%   -3.09%  (p=0.001 n=8+9)
      LeadingZeros32-4  2.14ns ± 0%  1.48ns ± 0%  -30.84%  (p=0.002 n=8+10)
      LeadingZeros64-4  2.06ns ± 1%  1.33ns ± 0%  -35.08%  (p=0.000 n=8+8)
      
      8-bit args is a special case - the Go code is really fast because
      it is just a single table lookup.  So I've disabled that for now.
      Intrinsics were actually slower:
      LeadingZeros8-4   1.22ns ± 3%  1.58ns ± 1%  +29.56%  (p=0.000 n=10+10)
      
      Update #18616
      
      Change-Id: Ia9c289b9ba59c583ea64060470315fd637e814cf
      Reviewed-on: https://go-review.googlesource.com/38311
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      495b1679
    • Steve Francia's avatar
      doc: reorganize the contribution guidelines into a guide · 5f3e7aa7
      Steve Francia authored
      Updates #17802
      
      Change-Id: I65ea0f4cde973604c04051e7eb25d12e4facecd3
      Reviewed-on: https://go-review.googlesource.com/36626Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarChris Broadfoot <cbro@golang.org>
      5f3e7aa7
    • Aliaksandr Valialkin's avatar
      strconv: optimize formatting for small decimal ints · bc8b9b23
      Aliaksandr Valialkin authored
      Avoid memory allocations by returning pre-calculated strings
      for decimal ints in the range 0..99.
      
      Benchmark results:
      
      name              old time/op    new time/op    delta
      FormatInt-4         2.45µs ± 1%    2.40µs ± 1%    -1.86%  (p=0.000 n=8+9)
      AppendInt-4         1.67µs ± 1%    1.65µs ± 0%    -0.92%  (p=0.000 n=10+10)
      FormatUint-4         676ns ± 3%     669ns ± 1%      ~     (p=0.146 n=10+10)
      AppendUint-4         467ns ± 2%     474ns ± 0%    +1.58%  (p=0.000 n=10+10)
      FormatIntSmall-4    29.6ns ± 2%     3.3ns ± 0%   -88.98%  (p=0.000 n=10+9)
      AppendIntSmall-4    16.0ns ± 1%     8.5ns ± 0%   -46.98%  (p=0.000 n=10+9)
      
      name              old alloc/op   new alloc/op   delta
      FormatInt-4           576B ± 0%      576B ± 0%      ~     (all equal)
      AppendInt-4          0.00B          0.00B           ~     (all equal)
      FormatUint-4          224B ± 0%      224B ± 0%      ~     (all equal)
      AppendUint-4         0.00B          0.00B           ~     (all equal)
      FormatIntSmall-4     2.00B ± 0%     0.00B       -100.00%  (p=0.000 n=10+10)
      AppendIntSmall-4     0.00B          0.00B           ~     (all equal)
      
      name              old allocs/op  new allocs/op  delta
      FormatInt-4           37.0 ± 0%      35.0 ± 0%    -5.41%  (p=0.000 n=10+10)
      AppendInt-4           0.00           0.00           ~     (all equal)
      FormatUint-4          6.00 ± 0%      6.00 ± 0%      ~     (all equal)
      AppendUint-4          0.00           0.00           ~     (all equal)
      FormatIntSmall-4      1.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
      AppendIntSmall-4      0.00           0.00           ~     (all equal)
      
      Fixes #19445
      
      Change-Id: Ib1f8922f2e0b13743c847ee9e703d1dab77f705c
      Reviewed-on: https://go-review.googlesource.com/37963Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      bc8b9b23