1. 06 Mar, 2017 29 commits
  2. 05 Mar, 2017 2 commits
  3. 04 Mar, 2017 9 commits
    • Josh Bleecher Snyder's avatar
      cmd/internal/src: cache prefixed filenames · 57e03861
      Josh Bleecher Snyder authored
      CL 37234 introduced string concatenation into some hot code. 
      This CL does that work earlier and caches the result.
      
      Updates #19386
      
      Performance impact vs master:
      
      name       old time/op      new time/op      delta
      Template        223ms ± 5%       216ms ± 5%   -2.98%  (p=0.001 n=20+20)
      Unicode        98.7ms ± 4%      99.0ms ± 4%     ~     (p=0.749 n=20+19)
      GoTypes         631ms ± 4%       626ms ± 4%     ~     (p=0.253 n=20+20)
      Compiler        2.91s ± 1%       2.87s ± 3%   -1.11%  (p=0.005 n=18+20)
      SSA             4.48s ± 2%       4.36s ± 2%   -2.77%  (p=0.000 n=20+20)
      Flate           130ms ± 2%       129ms ± 6%     ~     (p=0.428 n=19+20)
      GoParser        160ms ± 4%       157ms ± 3%   -1.62%  (p=0.005 n=20+18)
      Reflect         395ms ± 2%       394ms ± 4%     ~     (p=0.445 n=20+20)
      Tar             120ms ± 5%       118ms ± 6%     ~     (p=0.101 n=19+20)
      XML             224ms ± 3%       223ms ± 3%     ~     (p=0.544 n=19+19)
      
      name       old user-ns/op   new user-ns/op   delta
      Template   291user-ms ± 5%  265user-ms ± 5%   -9.02%  (p=0.000 n=20+19)
      Unicode    140user-ms ± 3%  139user-ms ± 8%     ~     (p=0.904 n=20+20)
      GoTypes    844user-ms ± 3%  849user-ms ± 3%     ~     (p=0.251 n=20+18)
      Compiler   4.06user-s ± 5%  3.98user-s ± 2%     ~     (p=0.056 n=20+20)
      SSA        6.89user-s ± 5%  6.50user-s ± 3%   -5.61%  (p=0.000 n=20+20)
      Flate      164user-ms ± 5%  163user-ms ± 4%     ~     (p=0.365 n=20+19)
      GoParser   206user-ms ± 6%  204user-ms ± 4%     ~     (p=0.534 n=20+18)
      Reflect    501user-ms ± 4%  505user-ms ± 5%     ~     (p=0.383 n=20+20)
      Tar        151user-ms ± 3%  152user-ms ± 7%     ~     (p=0.798 n=17+20)
      XML        283user-ms ± 7%  280user-ms ± 5%     ~     (p=0.301 n=20+20)
      
      name       old alloc/op     new alloc/op     delta
      Template       42.5MB ± 0%      40.2MB ± 0%   -5.59%  (p=0.000 n=20+20)
      Unicode        31.7MB ± 0%      31.0MB ± 0%   -2.19%  (p=0.000 n=20+18)
      GoTypes         124MB ± 0%       117MB ± 0%   -5.90%  (p=0.000 n=20+20)
      Compiler        533MB ± 0%       490MB ± 0%   -8.07%  (p=0.000 n=20+20)
      SSA             989MB ± 0%       893MB ± 0%   -9.74%  (p=0.000 n=20+20)
      Flate          27.8MB ± 0%      26.1MB ± 0%   -5.92%  (p=0.000 n=20+20)
      GoParser       34.3MB ± 0%      32.1MB ± 0%   -6.43%  (p=0.000 n=19+20)
      Reflect        84.6MB ± 0%      81.4MB ± 0%   -3.84%  (p=0.000 n=20+20)
      Tar            28.8MB ± 0%      27.7MB ± 0%   -3.89%  (p=0.000 n=20+20)
      XML            47.2MB ± 0%      44.2MB ± 0%   -6.45%  (p=0.000 n=20+19)
      
      name       old allocs/op    new allocs/op    delta
      Template         420k ± 1%        381k ± 1%   -9.35%  (p=0.000 n=20+20)
      Unicode          338k ± 1%        324k ± 1%   -4.29%  (p=0.000 n=20+19)
      GoTypes         1.28M ± 0%       1.15M ± 0%  -10.30%  (p=0.000 n=20+20)
      Compiler        5.06M ± 0%       4.41M ± 0%  -12.92%  (p=0.000 n=20+20)
      SSA             9.14M ± 0%       7.91M ± 0%  -13.46%  (p=0.000 n=19+20)
      Flate            267k ± 0%        241k ± 1%   -9.53%  (p=0.000 n=20+20)
      GoParser         347k ± 1%        312k ± 0%  -10.15%  (p=0.000 n=19+20)
      Reflect         1.07M ± 0%       1.00M ± 0%   -6.86%  (p=0.000 n=20+20)
      Tar              274k ± 1%        256k ± 1%   -6.73%  (p=0.000 n=20+20)
      XML              448k ± 0%        398k ± 0%  -11.17%  (p=0.000 n=20+18)
      
      
      Performance impact when applied together with CL 37234
      atop CL 37234's parent commit (i.e. as if it were
      a part of CL 37234), to show that this commit
      makes CL 37234 completely performance-neutral:
      
      name       old time/op      new time/op      delta
      Template        222ms ±14%       222ms ±14%    ~     (p=1.000 n=14+15)
      Unicode         104ms ±18%       106ms ±18%    ~     (p=0.650 n=13+14)
      GoTypes         653ms ± 7%       638ms ± 5%    ~     (p=0.145 n=14+12)
      Compiler        3.10s ± 1%       3.13s ±10%    ~     (p=1.000 n=2+2)
      SSA             4.73s ±11%       4.68s ±11%    ~     (p=0.567 n=15+15)
      Flate           136ms ± 4%       133ms ± 7%    ~     (p=0.231 n=12+14)
      GoParser        163ms ±11%       169ms ±10%    ~     (p=0.352 n=14+14)
      Reflect         415ms ±15%       423ms ±20%    ~     (p=0.715 n=15+14)
      Tar             133ms ±17%       130ms ±23%    ~     (p=0.252 n=14+15)
      XML             236ms ±16%       235ms ±14%    ~     (p=0.874 n=14+14)
      
      name       old user-ns/op   new user-ns/op   delta
      Template   271user-ms ±10%  271user-ms ±10%    ~     (p=0.780 n=14+15)
      Unicode    143user-ms ± 5%  146user-ms ±11%    ~     (p=0.432 n=12+14)
      GoTypes    864user-ms ± 5%  866user-ms ± 9%    ~     (p=0.905 n=14+13)
      Compiler   4.17user-s ± 1%  4.26user-s ± 7%    ~     (p=1.000 n=2+2)
      SSA        6.79user-s ± 8%  6.79user-s ± 6%    ~     (p=0.902 n=15+15)
      Flate      169user-ms ± 8%  164user-ms ± 5%  -3.13%  (p=0.014 n=14+14)
      GoParser   212user-ms ± 7%  217user-ms ±22%    ~     (p=1.000 n=13+15)
      Reflect    521user-ms ± 7%  533user-ms ±15%    ~     (p=0.511 n=14+14)
      Tar        165user-ms ±17%  161user-ms ±15%    ~     (p=0.345 n=15+15)
      XML        294user-ms ±11%  292user-ms ±10%    ~     (p=0.839 n=14+14)
      
      name       old alloc/op     new alloc/op     delta
      Template       39.9MB ± 0%      39.9MB ± 0%    ~     (p=0.621 n=15+14)
      Unicode        31.0MB ± 0%      31.0MB ± 0%    ~     (p=0.098 n=13+15)
      GoTypes         117MB ± 0%       117MB ± 0%    ~     (p=0.775 n=15+15)
      Compiler        488MB ± 0%       488MB ± 0%    ~     (p=0.333 n=2+2)
      SSA             892MB ± 0%       892MB ± 0%  +0.03%  (p=0.000 n=15+15)
      Flate          26.1MB ± 0%      26.1MB ± 0%    ~     (p=0.098 n=15+15)
      GoParser       31.8MB ± 0%      31.8MB ± 0%    ~     (p=0.525 n=15+13)
      Reflect        81.2MB ± 0%      81.2MB ± 0%  +0.06%  (p=0.001 n=12+14)
      Tar            27.5MB ± 0%      27.5MB ± 0%    ~     (p=0.595 n=15+15)
      XML            44.1MB ± 0%      44.1MB ± 0%    ~     (p=0.486 n=15+15)
      
      name       old allocs/op    new allocs/op    delta
      Template         378k ± 1%        378k ± 0%    ~     (p=0.949 n=15+14)
      Unicode          324k ± 0%        324k ± 1%    ~     (p=0.057 n=14+15)
      GoTypes         1.15M ± 0%       1.15M ± 0%    ~     (p=0.461 n=15+15)
      Compiler        4.39M ± 0%       4.39M ± 0%    ~     (p=0.333 n=2+2)
      SSA             7.90M ± 0%       7.90M ± 0%  +0.06%  (p=0.008 n=15+15)
      Flate            240k ± 1%        241k ± 0%    ~     (p=0.233 n=15+15)
      GoParser         309k ± 1%        309k ± 0%    ~     (p=0.867 n=15+12)
      Reflect         1.00M ± 0%       1.00M ± 0%    ~     (p=0.139 n=12+15)
      Tar              254k ± 1%        253k ± 1%    ~     (p=0.345 n=15+15)
      XML              398k ± 0%        397k ± 1%    ~     (p=0.267 n=15+15)
      
      
      Change-Id: Ic999a0f456a371c99eebba0f9747263a13836e33
      Reviewed-on: https://go-review.googlesource.com/37766
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      57e03861
    • Kevin Burke's avatar
      os/user: add non-cgo versions of Lookup, LookupId · c2eb0619
      Kevin Burke authored
      If you cross compile for a Unix target and call user.Lookup("root")
      or user.LookupId("0"), we'll try to read the answer out of
      /etc/passwd instead of returning an "unimplemented" error.
      
      The equivalent cgo function calls getpwuid_r in glibc, which
      may reach out to the NSS database or allow callers to register
      extensions. The pure Go implementation only reads from /etc/passwd.
      
      Change-Id: I56a302d634b15ba5097f9f0d6a758c68e486ba6d
      Reviewed-on: https://go-review.googlesource.com/37664Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c2eb0619
    • Giovanni Bajo's avatar
      cmd/compile: improve generic rules for BCE based on AND operations. · 4fc45ae8
      Giovanni Bajo authored
      Match more patterns generated by the compiler where the index for
      a bound check is bounded through a AND operation, with different
      register sizes.
      
      These rules trigger a dozen of times in a bootstrap.
      
      Change-Id: Ic9fff16f21d08580f19a366c3ee1a372e58357d1
      Reviewed-on: https://go-review.googlesource.com/37442
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      4fc45ae8
    • Austin Clements's avatar
      runtime: make ReadMemStats STW for < 25µs · 4a7cf960
      Austin Clements authored
      Currently ReadMemStats stops the world for ~1.7 ms/GB of heap because
      it collects statistics from every single span. For large heaps, this
      can be quite costly. This is particularly unfortunate because many
      production infrastructures call this function regularly to collect and
      report statistics.
      
      Fix this by tracking the necessary cumulative statistics in the
      mcaches. ReadMemStats still has to stop the world to stabilize these
      statistics, but there are only O(GOMAXPROCS) mcaches to collect
      statistics from, so this pause is only 25µs even at GOMAXPROCS=100.
      
      Fixes #13613.
      
      Change-Id: I3c0a4e14833f4760dab675efc1916e73b4c0032a
      Reviewed-on: https://go-review.googlesource.com/34937
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      4a7cf960
    • Austin Clements's avatar
      runtime: remove unused gcstats · 3399fd25
      Austin Clements authored
      The gcstats structure is no longer consumed by anything and no longer
      tracks statistics that are particularly relevant to the concurrent
      garbage collector. Remove it. (Having statistics is probably a good
      idea, but these aren't the stats we need these days and we don't have
      a way to get them out of the runtime.)
      
      In preparation for #13613.
      
      Change-Id: Ib63e2f9067850668f9dcbfd4ed89aab4a6622c3f
      Reviewed-on: https://go-review.googlesource.com/34936
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      3399fd25
    • Elias Naur's avatar
      misc/ios,cmd/go, runtime/cgo: fix iOS test harness (again) · 7523baed
      Elias Naur authored
      The iOS test harness was recently changed in response to lldb bugs
      to replace breakpoints with the SIGUSR2 signal (CL 34926), and to
      pass the current directory in the test binary arguments (CL 35152).
      Both the signal sending and working directory setup is done from
      the go test driver.
      
      However, the new method doesn't work with tests where a C program is
      the test driver instead of go test: the current working directory
      will not be changed and SIGUSR2 is not raised.
      
      Instead of copying that logic into any C test program, rework the
      test harness (again) to move the setup logic to the early runtime
      cgo setup code. That way, the harness will run even in the library
      build modes.
      
      Then, use the app Info.plist file to pass the working
      directory, removing the need to alter the arguments after running.
      
      Finally, use the SIGINT signal instead of SIGUSR2 to avoid
      manipulating the signal masks or handlers.
      
      Fixes the testcarchive tests on iOS.
      
      With this CL, both darwin/arm and darwin/arm64 passes all.bash.
      
      This CL replaces CL 34926, CL 35152 as well as the fixup CL
      35123 and CL 35255. They are reverted in CLs earlier in the
      relation chain.
      
      Change-Id: I8485c7db1404fbd8daa261efd1ea89e905121a3e
      Reviewed-on: https://go-review.googlesource.com/36090
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      7523baed
    • Elias Naur's avatar
      Revert "cmd/go, misc: switch from breakpoint to SIGUSR2" · fec40bd1
      Elias Naur authored
      This reverts commit 333f764d.
      
      Replaced by a improved strategy later in the CL relation chain.
      
      Change-Id: I70a1d2f0aa5aa0d3d0ec85b5a956c6fb60d88908
      Reviewed-on: https://go-review.googlesource.com/36069
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      fec40bd1
    • Josh Bleecher Snyder's avatar
      cmd/compile: cull UINF · 03e2a4d1
      Josh Bleecher Snyder authored
      It was used with Node.Ullman, which is now gone.
      
      Change-Id: I83b167645659ae7ef70043b7915d642e42ca524f
      Reviewed-on: https://go-review.googlesource.com/37761
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      03e2a4d1
    • Dmitri Shuralyov's avatar
      go/build: fix lack of error for Import of nonexistent local import path · e646d073
      Dmitri Shuralyov authored
      When calling build.Import, normally, an error is returned if the
      directory doesn't exist. However, that didn't happen for local
      import paths when build.FindOnly ImportMode was used.
      
      This change fixes that, and adds tests. It also makes the error
      value more consistent in all scenarios where it occurs.
      
      When calling build.Import with a local import path, the package
      can only exist in a single deterministic directory. That makes
      it possible verify that directory exists earlier in the path,
      and return a "cannot find package" error if it doesn't.
      Previously, this occurred only when build.FindOnly ImportMode
      was not set. It occurred quite late, after getting past Found
      label, to line that calls ctxt.readDir. Doing so would return
      an error like "no such file or directory" when the directory
      does not exist.
      
      Fixes #17863.
      Updates #17888 (relevant issue I ran into while working on this CL).
      
      Change-Id: If6a6996ac6176ac203a88bd31419748f88d89d7c
      Reviewed-on: https://go-review.googlesource.com/33158Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e646d073