1. 16 May, 2019 6 commits
  2. 15 May, 2019 8 commits
  3. 14 May, 2019 14 commits
  4. 13 May, 2019 12 commits
    • Robert Griesemer's avatar
      spec: clarify the difference between &T{} and new(T) · eebb9db0
      Robert Griesemer authored
      Add a small paragraph and example pointing out
      the difference for the case where T is a slice
      or map. This is a common error for Go novices.
      
      Fixes #29425.
      
      Change-Id: Icdb59f25361e9f6a09b190fbfcc9ae0c7d90077b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176338Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      eebb9db0
    • Robert Griesemer's avatar
      spec: clarify language on package-level variable initialization · 451cf3e2
      Robert Griesemer authored
      The very first paragraph on "Package initialization" stated that
      "variables are initialized in declaration order, but after any
      variables they might depend on". This phrasing was easily
      misread as "declaration order is the first sorting criteria"
      and then contradicted what the subsequent paragraphs spelled
      out in precise detail.
      
      Instead, variable initialization proceeds by repeatedly determining
      a set of ready to initialize variables, and then selecting from that
      set the variable declared earliest. That is, declaration order is the
      second sorting criteria.
      
      Also, for the purpose of variable initialization, declarations
      introducing blank (_) variables are considered like any other
      variables (their initialization expressions may have side-effects
      and affect initialization order), even though blank identifiers
      are not "declared".
      
      This CL adds clarifying language regarding these two issues
      and the supporting example.
      
      Both gccgo and go/types implement this behavior. cmd/compile
      has a long-standing issue (#22326).
      
      The spec also did not state in which order multiple variables
      initialized by a single (multi-value) initialization expression are
      handled. This CL adds a clarifying paragraph: If any such variable
      is initialized, all that declaration's variables are initialized at
      the same time.
      
      This behavior matches user expectation: We are not expecting to
      observe partially initialized sets of variables in declarations
      such as "var a, b, c = f()".
      
      It also matches existing cmd/compile and go/types (but not gccgo)
      behavior.
      
      Finally, cmd/compile, gccgo, and go/types produce different
      initialization orders in (esoteric) cases where hidden (not
      detected with existing rules) dependencies exist. Added a
      sentence and example clarifying how much leeway compilers have
      in those situations. The goal is to preserve the ability to
      use static initialization while at the same time maintain
      the relative initialization order of variables with detected
      dependencies.
      
      Fixes   #31292.
      Updates #22326.
      
      Change-Id: I0a369abff8cfce27afc975998db875f5c580caa2
      Reviewed-on: https://go-review.googlesource.com/c/go/+/175980Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      451cf3e2
    • Josh Bleecher Snyder's avatar
      cmd/compile: mark a few more tests as parallel · 5d983303
      Josh Bleecher Snyder authored
      Reduces the time on my machine for
      
      go clean -cache; go test -short -count=1 cmd/compile/internal/gc
      
      from 4.7s to 3.7s.
      
      Updates #26473
      
      Change-Id: I9f9573675ffd6519da63961f48f61260ae4717fd
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176937
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      5d983303
    • Josh Bleecher Snyder's avatar
      cmd/objdump: ensure that test executable files are distinct · f68244e6
      Josh Bleecher Snyder authored
      This fixes test failures introduced by CL 176901.
      
      Change-Id: I133299ba3be3a15ced076c95e4833ba6070d7eb7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176903
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      f68244e6
    • Josh Bleecher Snyder's avatar
      cmd/fix: mark tests as parallel · 33786830
      Josh Bleecher Snyder authored
      This speeds up
      
      go test -short -count=1 cmd/fix
      
      on my machine from about 8s to about 0.05s.
      
      Updates #26473
      
      Change-Id: I698ee20704ae0aee874ba642e7b0e070ddc99194
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176900
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      33786830
    • Tamir Duberstein's avatar
      runtime: resolve latent TODOs · 9c86eae3
      Tamir Duberstein authored
      These were added in https://go-review.googlesource.com/1224; according
      to austin@google.com these annotations are not valuable - resolving by
      removing the TODOs.
      
      Change-Id: Icf3f21bc385cac9673ba29f0154680e970cf91f2
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176899Reviewed-by: default avatarAustin Clements <austin@google.com>
      9c86eae3
    • Jay Conrod's avatar
      cmd/go: make 'go get' match patterns against packages, not modules · 71be83e8
      Jay Conrod authored
      This is a follow-up to CL 174099, fixing an important TODO.
      The 'go help modget' documentation will be clarified in anotehr CL,
      pending further discussion.
      
      When invoked without -m, 'go get' will no longer match arguments
      containing "..." against module paths. If a module's path matches a
      pattern but no packages within the module match the pattern, the
      module should not be upgraded. For example, if
      golang.org/x/tools/playground and golang.org/x/tools are separate
      modules, and only golang.org/x/tools is in the build list,
      'go get golang.org/x/tools/playground/...' should add
      golang.org/x/tools/playground to the build list and leave
      golang.org/x/tools alone.
      
      Updates #26902
      
      Change-Id: I2bd18c7950db1aa7bd8527210c1baf2c7d174375
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176578
      Run-TryBot: Jay Conrod <jayconrod@google.com>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      71be83e8
    • Josh Bleecher Snyder's avatar
      cmd/objdump: mark tests as parallel · ed7a92ba
      Josh Bleecher Snyder authored
      Speeds up
      
      go test -short -count=1 cmd/objdump
      
      on my machine from 1.7s to 1.3s.
      
      Not much, but as the backpacking saying goes,
      take care of the ounces and the pounds will take care of themselves.
      
      Updates #26473
      
      Change-Id: I59fe9a179e48537c7d82cbba72cde9f92b42a029
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176901
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ed7a92ba
    • Luka Zitnik's avatar
      cmd/go: print finally FAIL if a test has failed in package list mode · 3def99a8
      Luka Zitnik authored
      Fixes #30507
      
      Change-Id: Ic598e4d5f71c624fcde051982bf85533e2f18e8d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170948Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      3def99a8
    • Cherry Zhang's avatar
      cmd/compile: correct the argument type in SETXXstore -> MOVBstore rules on AMD64 · 23f3ea82
      Cherry Zhang authored
      MOVBstore's value argument is a value, not a flag. We are storing
      a byte so just use UInt8.
      
      Fixes #31915.
      
      Change-Id: Id799e5f44efc3a9c3d8480f6f25ad032c2a631bb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176719
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      23f3ea82
    • Russ Cox's avatar
      index/suffixarray: index 3-10X faster in half the memory · 6ca324f2
      Russ Cox authored
      This CL changes the index/suffixarray construction algorithm from QSufSort to SAIS.
      
      For an N-byte input, QSufSort runs in O(N log N) time and requires
      an N-int temporary work space in addition to the N-int output.
      
      In contrast, SAIS runs in O(N) time and, for essentially all real inputs,
      is able to use the N-int output buffer as its temporary work space.
      (In pathological cases, SAIS must allocate a temporary work space of
      at most N/2 ints. There exist more complex variants that guarantee
      to avoid the work space in all cases, but they hardly seem worth the cost
      given how rare these pathological cases are.)
      
      The SAIS code therefore uses 50% of the memory across the board.
      It also runs 3-10X faster on real input text.
      
      This CL also adds more extensive algorithmic tests, including an
      exhaustive test over small inputs to catch corner case problems.
      
      name                                   old speed      new speed        delta
      New/text=opticks/size=100K/bits=32-12  6.15MB/s ± 1%   26.79MB/s ± 1%   +335.89%  (p=0.008 n=5+5)
      New/text=opticks/size=100K/bits=64-12  5.90MB/s ± 2%   27.29MB/s ± 2%   +362.23%  (p=0.008 n=5+5)
      New/text=opticks/size=500K/bits=32-12  4.99MB/s ± 3%   25.37MB/s ± 2%   +408.01%  (p=0.008 n=5+5)
      New/text=opticks/size=500K/bits=64-12  4.88MB/s ± 1%   25.66MB/s ± 4%   +425.52%  (p=0.008 n=5+5)
      New/text=go/size=100K/bits=32-12       5.81MB/s ± 1%   26.49MB/s ± 2%   +355.85%  (p=0.008 n=5+5)
      New/text=go/size=100K/bits=64-12       5.76MB/s ± 2%   26.65MB/s ± 3%   +362.60%  (p=0.008 n=5+5)
      New/text=go/size=500K/bits=32-12       4.91MB/s ± 1%   25.12MB/s ± 2%   +411.86%  (p=0.008 n=5+5)
      New/text=go/size=500K/bits=64-12       4.83MB/s ± 2%   25.79MB/s ± 2%   +434.44%  (p=0.008 n=5+5)
      New/text=go/size=1M/bits=32-12         4.62MB/s ± 2%   24.87MB/s ± 2%   +438.78%  (p=0.008 n=5+5)
      New/text=go/size=1M/bits=64-12         4.39MB/s ± 2%   24.61MB/s ± 2%   +460.68%  (p=0.008 n=5+5)
      New/text=go/size=5M/bits=32-12         2.85MB/s ± 2%   24.78MB/s ± 7%   +768.33%  (p=0.008 n=5+5)
      New/text=go/size=5M/bits=64-12         2.28MB/s ± 1%   18.70MB/s ± 7%   +719.63%  (p=0.008 n=5+5)
      New/text=go/size=10M/bits=32-12        2.08MB/s ± 1%   21.04MB/s ± 6%   +909.60%  (p=0.008 n=5+5)
      New/text=go/size=10M/bits=64-12        1.83MB/s ± 1%   16.64MB/s ± 2%   +809.18%  (p=0.008 n=5+5)
      New/text=go/size=50M/bits=32-12        1.51MB/s ± 0%   10.58MB/s ± 1%   +602.52%  (p=0.008 n=5+5)
      New/text=go/size=50M/bits=64-12        1.34MB/s ± 4%    9.00MB/s ± 1%   +569.35%  (p=0.008 n=5+5)
      New/text=zero/size=100K/bits=32-12     4.17MB/s ± 0%  157.56MB/s ± 1%  +3678.42%  (p=0.016 n=4+5)
      New/text=zero/size=100K/bits=64-12     4.19MB/s ± 2%  162.72MB/s ± 2%  +3783.63%  (p=0.008 n=5+5)
      New/text=zero/size=500K/bits=32-12     3.72MB/s ± 5%  159.17MB/s ± 1%  +4176.57%  (p=0.008 n=5+5)
      New/text=zero/size=500K/bits=64-12     3.77MB/s ± 3%  164.95MB/s ± 4%  +4277.60%  (p=0.008 n=5+5)
      New/text=zero/size=1M/bits=32-12       3.46MB/s ± 3%  158.42MB/s ± 1%  +4476.08%  (p=0.008 n=5+5)
      New/text=zero/size=1M/bits=64-12       3.41MB/s ± 4%  163.70MB/s ± 2%  +4700.65%  (p=0.008 n=5+5)
      New/text=zero/size=5M/bits=32-12       3.12MB/s ± 2%  151.92MB/s ± 4%  +4775.48%  (p=0.008 n=5+5)
      New/text=zero/size=5M/bits=64-12       3.09MB/s ± 2%  166.19MB/s ± 2%  +5274.84%  (p=0.008 n=5+5)
      New/text=zero/size=10M/bits=32-12      2.97MB/s ± 1%  157.75MB/s ± 1%  +5211.38%  (p=0.008 n=5+5)
      New/text=zero/size=10M/bits=64-12      2.92MB/s ± 1%  162.75MB/s ± 2%  +5473.77%  (p=0.008 n=5+5)
      New/text=zero/size=50M/bits=32-12      2.67MB/s ± 1%  144.43MB/s ± 5%  +5305.39%  (p=0.008 n=5+5)
      New/text=zero/size=50M/bits=64-12      2.61MB/s ± 1%  125.19MB/s ± 2%  +4700.33%  (p=0.016 n=5+4)
      New/text=rand/size=100K/bits=32-12     8.69MB/s ± 6%   27.60MB/s ± 1%   +217.73%  (p=0.008 n=5+5)
      New/text=rand/size=100K/bits=64-12     8.92MB/s ± 1%   26.37MB/s ± 4%   +195.50%  (p=0.008 n=5+5)
      New/text=rand/size=500K/bits=32-12     7.11MB/s ± 2%   25.23MB/s ± 2%   +254.78%  (p=0.008 n=5+5)
      New/text=rand/size=500K/bits=64-12     7.08MB/s ± 1%   25.45MB/s ± 2%   +259.56%  (p=0.008 n=5+5)
      New/text=rand/size=1M/bits=32-12       6.45MB/s ± 2%   24.47MB/s ± 3%   +279.11%  (p=0.008 n=5+5)
      New/text=rand/size=1M/bits=64-12       6.09MB/s ± 4%   23.00MB/s ± 4%   +277.85%  (p=0.008 n=5+5)
      New/text=rand/size=5M/bits=32-12       3.68MB/s ± 3%   10.34MB/s ± 5%   +181.08%  (p=0.008 n=5+5)
      New/text=rand/size=5M/bits=64-12       3.25MB/s ± 1%    6.23MB/s ± 1%    +91.93%  (p=0.008 n=5+5)
      New/text=rand/size=10M/bits=32-12      3.03MB/s ± 1%    5.61MB/s ± 2%    +85.28%  (p=0.008 n=5+5)
      New/text=rand/size=10M/bits=64-12      2.80MB/s ± 1%    4.29MB/s ± 2%    +53.40%  (p=0.008 n=5+5)
      New/text=rand/size=50M/bits=32-12      2.11MB/s ± 0%    2.45MB/s ± 1%    +16.23%  (p=0.029 n=4+4)
      New/text=rand/size=50M/bits=64-12      2.04MB/s ± 1%    2.24MB/s ± 1%    +10.03%  (p=0.016 n=5+4)
      SaveRestore/bits=32-12                  327MB/s ± 5%     319MB/s ± 2%       ~     (p=0.310 n=5+5)
      SaveRestore/bits=64-12                  306MB/s ± 3%     306MB/s ± 2%       ~     (p=0.841 n=5+5)
      
      name                                   old alloc/op   new alloc/op     delta
      New/text=opticks/size=100K/bits=32-12     811kB ± 0%       401kB ± 0%    -50.51%  (p=0.008 n=5+5)
      New/text=opticks/size=100K/bits=64-12    1.62MB ± 0%      0.80MB ± 0%    -50.51%  (p=0.008 n=5+5)
      New/text=opticks/size=500K/bits=32-12    4.04MB ± 0%      2.01MB ± 0%    -50.37%  (p=0.008 n=5+5)
      New/text=opticks/size=500K/bits=64-12    8.07MB ± 0%      4.01MB ± 0%    -50.36%  (p=0.016 n=4+5)
      New/text=go/size=100K/bits=32-12          811kB ± 0%       401kB ± 0%       ~     (p=0.079 n=4+5)
      New/text=go/size=100K/bits=64-12         1.62MB ± 0%      0.80MB ± 0%    -50.50%  (p=0.008 n=5+5)
      New/text=go/size=500K/bits=32-12         4.04MB ± 0%      2.01MB ± 0%       ~     (p=0.079 n=4+5)
      New/text=go/size=500K/bits=64-12         8.07MB ± 0%      4.01MB ± 0%    -50.36%  (p=0.000 n=4+5)
      New/text=go/size=1M/bits=32-12           8.07MB ± 0%      4.01MB ± 0%    -50.36%  (p=0.008 n=5+5)
      New/text=go/size=1M/bits=64-12           16.1MB ± 0%       8.0MB ± 0%    -50.36%  (p=0.008 n=5+5)
      New/text=go/size=5M/bits=32-12           40.2MB ± 0%      20.0MB ± 0%    -50.18%  (p=0.008 n=5+5)
      New/text=go/size=5M/bits=64-12           80.3MB ± 0%      40.0MB ± 0%    -50.18%  (p=0.008 n=5+5)
      New/text=go/size=10M/bits=32-12          80.2MB ± 0%      40.0MB ± 0%    -50.09%  (p=0.000 n=5+4)
      New/text=go/size=10M/bits=64-12           160MB ± 0%        80MB ± 0%    -50.09%  (p=0.000 n=5+4)
      New/text=go/size=50M/bits=32-12           402MB ± 0%       200MB ± 0%    -50.29%  (p=0.000 n=5+4)
      New/text=go/size=50M/bits=64-12           805MB ± 0%       400MB ± 0%    -50.29%  (p=0.000 n=5+4)
      New/text=zero/size=100K/bits=32-12       1.46MB ± 0%      0.40MB ± 0%    -72.46%  (p=0.008 n=5+5)
      New/text=zero/size=100K/bits=64-12       3.02MB ± 0%      0.80MB ± 0%    -73.45%  (p=0.008 n=5+5)
      New/text=zero/size=500K/bits=32-12       8.66MB ± 0%      2.01MB ± 0%       ~     (p=0.079 n=4+5)
      New/text=zero/size=500K/bits=64-12       19.7MB ± 0%       4.0MB ± 0%    -79.63%  (p=0.008 n=5+5)
      New/text=zero/size=1M/bits=32-12         19.7MB ± 0%       4.0MB ± 0%       ~     (p=0.079 n=4+5)
      New/text=zero/size=1M/bits=64-12         39.0MB ± 0%       8.0MB ± 0%    -79.48%  (p=0.000 n=5+4)
      New/text=zero/size=5M/bits=32-12         85.2MB ± 0%      20.0MB ± 0%    -76.52%  (p=0.008 n=5+5)
      New/text=zero/size=5M/bits=64-12          169MB ± 0%        40MB ± 0%    -76.27%  (p=0.008 n=5+5)
      New/text=zero/size=10M/bits=32-12         169MB ± 0%        40MB ± 0%    -76.26%  (p=0.000 n=5+4)
      New/text=zero/size=10M/bits=64-12         333MB ± 0%        80MB ± 0%    -75.99%  (p=0.008 n=5+5)
      New/text=zero/size=50M/bits=32-12         739MB ± 0%       200MB ± 0%    -72.93%  (p=0.000 n=4+5)
      New/text=zero/size=50M/bits=64-12        1.63GB ± 0%      0.40GB ± 0%    -75.42%  (p=0.008 n=5+5)
      New/text=rand/size=100K/bits=32-12        807kB ± 0%       401kB ± 0%    -50.25%  (p=0.008 n=5+5)
      New/text=rand/size=100K/bits=64-12       1.61MB ± 0%      0.80MB ± 0%    -50.25%  (p=0.008 n=5+5)
      New/text=rand/size=500K/bits=32-12       4.04MB ± 0%      2.01MB ± 0%       ~     (p=0.079 n=4+5)
      New/text=rand/size=500K/bits=64-12       8.07MB ± 0%      4.01MB ± 0%       ~     (p=0.079 n=4+5)
      New/text=rand/size=1M/bits=32-12         8.07MB ± 0%      4.01MB ± 0%    -50.36%  (p=0.000 n=5+4)
      New/text=rand/size=1M/bits=64-12         16.1MB ± 0%       8.0MB ± 0%    -50.36%  (p=0.008 n=5+5)
      New/text=rand/size=5M/bits=32-12         40.3MB ± 0%      20.0MB ± 0%    -50.35%  (p=0.029 n=4+4)
      New/text=rand/size=5M/bits=64-12         80.7MB ± 0%      40.0MB ± 0%       ~     (p=0.079 n=4+5)
      New/text=rand/size=10M/bits=32-12        80.7MB ± 0%      40.0MB ± 0%    -50.41%  (p=0.008 n=5+5)
      New/text=rand/size=10M/bits=64-12         161MB ± 0%        80MB ± 0%    -50.44%  (p=0.029 n=4+4)
      New/text=rand/size=50M/bits=32-12         403MB ± 0%       200MB ± 0%    -50.36%  (p=0.000 n=5+4)
      New/text=rand/size=50M/bits=64-12         806MB ± 0%       400MB ± 0%       ~     (p=0.079 n=4+5)
      SaveRestore/bits=32-12                   5.28MB ± 0%      5.28MB ± 0%       ~     (p=1.000 n=5+5)
      SaveRestore/bits=64-12                   9.47MB ± 0%      9.47MB ± 0%       ~     (p=0.286 n=5+5)
      
      https://perf.golang.org/search?q=upload:20190426.1
      
      Fixes #15480.
      
      Change-Id: I0790f6edf67f5a9c02b4462632b4942e0c37988b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/174100
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarEric Roshan-Eisner <edre@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      6ca324f2
    • Tamir Duberstein's avatar
      runtime: resolve latent function type TODO · 7a43f8a5
      Tamir Duberstein authored
      This was left over from the C->Go transition.
      
      Change-Id: I52494af3d49a388dc45b57210ba68292ae01cf84
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176897
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      7a43f8a5