1. 01 May, 2019 8 commits
    • David Chase's avatar
      runtime: look for idle p to run current goroutine when switching to GC or traceReader · e56c73f1
      David Chase authored
      This repairs one of the several causes of pauses uncovered
      by a GC microbenchmark.  A pause can occur when a goroutine's
      quantum expires "at the same time" a GC is needed.  The
      current M switches to running a GC worker, which means that
      the amount of available work has expanded by one.  The GC
      worker, however, does not call ready, and does not itself
      conditionally wake a P (a "normal" thread would do this).
      
      This is also true if M switches to a traceReader.
      
      This is problem 4 in this list:
      https://github.com/golang/go/issues/27732#issuecomment-423301252
      
      Updates #27732.
      
      Change-Id: I6905365cac8504cde6faab2420f4421536551f0b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/146817
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      e56c73f1
    • Russ Cox's avatar
      index/suffixarray: add 32-bit implementation · 45be3530
      Russ Cox authored
      The original index/suffixarray used 32-bit ints on 64-bit machines,
      because that's what 'int' meant in Go at the time. When we changed
      the meaning of int, that doubled the space overhead of suffix arrays
      for all uses, even though the vast majority of them describe less
      than 2 GB of text.
      
      The space overhead of a suffix array compared to the text is not
      insignificant: there's a big difference for many uses between 4X and 8X.
      
      This CL adjusts names in qsufsort.go so that a global search and
      replace s/32/64/g produces a working 64-bit implementation,
      and then it modifies suffixarray.go to choose between the 32-bit
      and 64-bit implementation as appropriate depending on the input size.
      The 64-bit implementation is generated by 'go generate'.
      
      This CL also restructures the benchmarks, to test different
      input sizes, different input texts, and 32-bit vs 64-bit.
      
      The serialized form uses varint-encoded numbers and is unchanged,
      so on-disk suffix arrays written by older versions of Go will be
      readable by this version, and vice versa.
      
      The 32-bit version runs a up to 17% faster than the 64-bit version
      on real inputs, but more importantly it uses 50% less memory.
      
      I have a followup CL that also implements a faster algorithm
      on top of these improvements, but these are a good first step.
      
      name                                  64-bit speed   32-bit speed    delta
      New/text=opticks/size=100K/bits=*-12  4.44MB/s ± 0%  4.64MB/s ± 0%   +4.41%  (p=0.008 n=5+5)
      New/text=opticks/size=500K/bits=*-12  3.70MB/s ± 1%  3.82MB/s ± 0%   +3.30%  (p=0.008 n=5+5)
      New/text=go/size=100K/bits=*-12       4.40MB/s ± 0%  4.61MB/s ± 0%   +4.82%  (p=0.008 n=5+5)
      New/text=go/size=500K/bits=*-12       3.66MB/s ± 0%  3.77MB/s ± 0%   +3.01%  (p=0.016 n=4+5)
      New/text=go/size=1M/bits=*-12         3.29MB/s ± 0%  3.55MB/s ± 0%   +7.90%  (p=0.016 n=5+4)
      New/text=go/size=5M/bits=*-12         2.25MB/s ± 1%  2.65MB/s ± 0%  +17.81%  (p=0.008 n=5+5)
      New/text=go/size=10M/bits=*-12        1.82MB/s ± 0%  2.09MB/s ± 1%  +14.36%  (p=0.008 n=5+5)
      New/text=go/size=50M/bits=*-12        1.35MB/s ± 0%  1.51MB/s ± 1%  +12.33%  (p=0.008 n=5+5)
      New/text=zero/size=100K/bits=*-12     3.42MB/s ± 0%  3.32MB/s ± 0%   -2.74%  (p=0.000 n=5+4)
      New/text=zero/size=500K/bits=*-12     3.00MB/s ± 1%  2.97MB/s ± 0%   -1.13%  (p=0.016 n=5+4)
      New/text=zero/size=1M/bits=*-12       2.81MB/s ± 0%  2.78MB/s ± 2%     ~     (p=0.167 n=5+5)
      New/text=zero/size=5M/bits=*-12       2.46MB/s ± 0%  2.53MB/s ± 0%   +3.18%  (p=0.008 n=5+5)
      New/text=zero/size=10M/bits=*-12      2.35MB/s ± 0%  2.42MB/s ± 0%   +2.98%  (p=0.016 n=4+5)
      New/text=zero/size=50M/bits=*-12      2.12MB/s ± 0%  2.18MB/s ± 0%   +3.02%  (p=0.008 n=5+5)
      New/text=rand/size=100K/bits=*-12     6.98MB/s ± 0%  7.22MB/s ± 0%   +3.38%  (p=0.016 n=4+5)
      New/text=rand/size=500K/bits=*-12     5.53MB/s ± 0%  5.64MB/s ± 0%   +1.92%  (p=0.008 n=5+5)
      New/text=rand/size=1M/bits=*-12       4.62MB/s ± 1%  5.06MB/s ± 0%   +9.61%  (p=0.008 n=5+5)
      New/text=rand/size=5M/bits=*-12       3.09MB/s ± 0%  3.43MB/s ± 0%  +10.94%  (p=0.016 n=4+5)
      New/text=rand/size=10M/bits=*-12      2.68MB/s ± 0%  2.95MB/s ± 0%  +10.39%  (p=0.008 n=5+5)
      New/text=rand/size=50M/bits=*-12      1.92MB/s ± 0%  2.06MB/s ± 1%   +7.41%  (p=0.008 n=5+5)
      SaveRestore/bits=*-12                  243MB/s ± 1%   259MB/s ± 0%   +6.68%  (p=0.000 n=9+10)
      
      name                               64-bit alloc/op  32-bit alloc/op  delta
      New/text=opticks/size=100K/bits=*-12    1.62MB ± 0%    0.81MB ± 0%  -50.00%  (p=0.000 n=5+4)
      New/text=opticks/size=500K/bits=*-12    8.07MB ± 0%    4.04MB ± 0%  -49.89%  (p=0.008 n=5+5)
      New/text=go/size=100K/bits=*-12         1.62MB ± 0%    0.81MB ± 0%  -50.00%  (p=0.008 n=5+5)
      New/text=go/size=500K/bits=*-12         8.07MB ± 0%    4.04MB ± 0%  -49.89%  (p=0.029 n=4+4)
      New/text=go/size=1M/bits=*-12           16.1MB ± 0%     8.1MB ± 0%  -49.95%  (p=0.008 n=5+5)
      New/text=go/size=5M/bits=*-12           80.3MB ± 0%    40.2MB ± 0%     ~     (p=0.079 n=4+5)
      New/text=go/size=10M/bits=*-12           160MB ± 0%      80MB ± 0%  -50.00%  (p=0.008 n=5+5)
      New/text=go/size=50M/bits=*-12           805MB ± 0%     402MB ± 0%  -50.06%  (p=0.029 n=4+4)
      New/text=zero/size=100K/bits=*-12       3.02MB ± 0%    1.46MB ± 0%     ~     (p=0.079 n=4+5)
      New/text=zero/size=500K/bits=*-12       19.7MB ± 0%     8.7MB ± 0%  -55.98%  (p=0.008 n=5+5)
      New/text=zero/size=1M/bits=*-12         39.0MB ± 0%    19.7MB ± 0%  -49.60%  (p=0.000 n=5+4)
      New/text=zero/size=5M/bits=*-12          169MB ± 0%      85MB ± 0%  -49.46%  (p=0.029 n=4+4)
      New/text=zero/size=10M/bits=*-12         333MB ± 0%     169MB ± 0%  -49.43%  (p=0.000 n=5+4)
      New/text=zero/size=50M/bits=*-12        1.63GB ± 0%    0.74GB ± 0%  -54.61%  (p=0.008 n=5+5)
      New/text=rand/size=100K/bits=*-12       1.61MB ± 0%    0.81MB ± 0%  -50.00%  (p=0.000 n=5+4)
      New/text=rand/size=500K/bits=*-12       8.07MB ± 0%    4.04MB ± 0%  -49.89%  (p=0.000 n=5+4)
      New/text=rand/size=1M/bits=*-12         16.1MB ± 0%     8.1MB ± 0%  -49.95%  (p=0.029 n=4+4)
      New/text=rand/size=5M/bits=*-12         80.7MB ± 0%    40.3MB ± 0%  -50.06%  (p=0.008 n=5+5)
      New/text=rand/size=10M/bits=*-12         161MB ± 0%      81MB ± 0%  -50.03%  (p=0.008 n=5+5)
      New/text=rand/size=50M/bits=*-12         806MB ± 0%     403MB ± 0%  -50.00%  (p=0.016 n=4+5)
      SaveRestore/bits=*-12                   9.47MB ± 0%    5.28MB ± 0%  -44.29%  (p=0.000 n=9+8)
      
      https://perf.golang.org/search?q=upload:20190126.1+|+bits:64+vs+bits:32
      
      Fixes #6816.
      
      Change-Id: Ied2fbea519a202ecc43719debcd233344ce38847
      Reviewed-on: https://go-review.googlesource.com/c/go/+/174097
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      45be3530
    • Lynn Boger's avatar
      cmd/compile/internal/ppc64: improve naming for ginsnop2 · b098c0f4
      Lynn Boger authored
      This is a follow up from a review comment at the end of the last
      Go release, to provide a more meaningful name for ginsnop2.
      
      Updates #30475
      
      Change-Id: Ice9efd763bf2204a9e8c55ae230d3e8a80210108
      Reviewed-on: https://go-review.googlesource.com/c/go/+/174757
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b098c0f4
    • Than McIntosh's avatar
      go/internal/gccgoimporter: skip new test with aliases with old gccgo · ab5cee53
      Than McIntosh authored
      Add the issue31540 test to the list of tests that needs to be skipped
      with old copies of gccgo. Along the way, add an explicit field to the
      importer test struct that can be used to tag the test (as opposed to
      having special cases by name in the test routine), so as to make it
      easier to remember to tag testcases correctly.
      
      Fixes #31764.
      
      Change-Id: Ib9d98fea2df8ce0b51e5a886fb2c4acd6db490ff
      Reviewed-on: https://go-review.googlesource.com/c/go/+/174738Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ab5cee53
    • Michael Anthony Knyszek's avatar
      runtime: change the span allocation policy to first-fit · 40036a99
      Michael Anthony Knyszek authored
      This change modifies the treap implementation to be address-ordered
      instead of size-ordered, and further augments it so it may be used for
      allocation. It then modifies the find method to implement a first-fit
      allocation policy.
      
      This change to the treap implementation consequently makes it so that
      spans are scavenged in highest-address-first order without any
      additional changes to the scavenging code. Because the treap itself is
      now address ordered, and the scavenging code iterates over it in
      reverse, the highest address is now chosen instead of the largest span.
      
      This change also renames the now wrongly-named "scavengeLargest" method
      on mheap to just "scavengeLocked" and also fixes up logic in that method
      which made assumptions about size.
      
      For #30333.
      
      Change-Id: I94b6f3209211cc1bfdc8cdaea04152a232cfbbb4
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164101
      Run-TryBot: Michael Knyszek <mknyszek@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      40036a99
    • Lynn Boger's avatar
      test: enable more memcombine tests for ppc64le · e30aa166
      Lynn Boger authored
      This enables more of the testcases in memcombine for ppc64le,
      and adds more detail to some existing.
      
      Change-Id: Ic522a1175bed682b546909c96f9ea758f8db247c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/174737Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e30aa166
    • Elias Naur's avatar
      os,time: fix tests on iOS · b39daa7a
      Elias Naur authored
      When fixing tests for for self-hosted iOS builds, I
      broke hosted builds.
      
      Updates #31722
      
      Change-Id: Id4e7d234fbd86cb2d29d320d75f4441efd663d12
      Reviewed-on: https://go-review.googlesource.com/c/go/+/174698
      Run-TryBot: Elias Naur <mail@eliasnaur.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      b39daa7a
    • Michael Vogt's avatar
      net: set DNSError.IsTemporary from addrinfoErrno errors · 7ee22139
      Michael Vogt authored
      Today it is not possible (AFAICT) to detect if a DNSError if of type EAI_AGAIN, i.e. if it is something temporary that should be retried. This information is available inside addrinfoErrno but when the DNSError is created this information is lost.
      
      This PR fixes this so that the addinfoErrno.Temporary information is added to DNSError as well. With that a user who gets a DNSError can check now is its a temporary error (for errors that resulted from a addrinfoErrno this is EAI_AGAIN).
      
      Change-Id: I64badb2ebd904e41fc2e0755416f7f32560534d8
      GitHub-Last-Rev: ced7238a6597039fb23f36f372bd1cf33d60d4a6
      GitHub-Pull-Request: golang/go#31676
      Reviewed-on: https://go-review.googlesource.com/c/go/+/174557Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      7ee22139
  2. 30 Apr, 2019 32 commits