1. 02 Apr, 2018 9 commits
    • Ilya Tocar's avatar
      strings: speed-up replace for byteStringReplacer case · fd22542e
      Ilya Tocar authored
      Use Count instead of loop to determine a number of replacements.
      Also increment index instead of advancing slices, to avoid some extra stores.
      Shows very significant speed-up on html benchmarks:
      
      Escape-6          34.2µs ± 2%  20.8µs ± 2%  -39.06%  (p=0.000 n=10+10)
      EscapeNone-6      7.04µs ± 1%  1.05µs ± 0%  -85.03%  (p=0.000 n=10+10)
      
      On benchmarks in package strings results are still significant:
      
      ByteStringMatch-6    1.59µs ± 2%    1.17µs ± 2%  -26.35%  (p=0.000 n=10+10)
      HTMLEscapeNew-6       390ns ± 2%     337ns ± 2%  -13.62%  (p=0.000 n=10+10)
      HTMLEscapeOld-6       621ns ± 2%     603ns ± 2%   -2.95%  (p=0.000 n=10+9)
      
      Change-Id: Ibea3235b6e451ba72cd5db57716d17b917e72944
      Reviewed-on: https://go-review.googlesource.com/97255
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      fd22542e
    • Matthew Dempsky's avatar
      cmd/compile: disable instrumentation for no-race packages earlier · c0841ecd
      Matthew Dempsky authored
      Rather than checking for each function whether the package supports
      instrumentation, check once up front.
      
      Relatedly, tweak the logic for preventing inlining calls to runtime
      functions from instrumented packages. Previously, we simply disallowed
      inlining runtime functions altogether when instrumenting. With this
      CL, it's only disallowed from packages that are actually being
      instrumented. That is, now intra-runtime calls can be inlined.
      
      Updates #19054.
      
      Change-Id: I88c97b48bf70193a8a3ee18d952dcb26b0369d55
      Reviewed-on: https://go-review.googlesource.com/102815
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      c0841ecd
    • Giovanni Bajo's avatar
      go/types: fix column reporting of invalid selector names · 69032440
      Giovanni Bajo authored
      Fixes #24645
      
      Change-Id: I914674451b6667c3ebaf012893503d9de58991ee
      Reviewed-on: https://go-review.googlesource.com/104155
      Run-TryBot: Giovanni Bajo <rasky@develer.com>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      69032440
    • Travis Bischel's avatar
      compress/gzip: do not count header bytes written in Write · f1deee0e
      Travis Bischel authored
      Before, if an underlying writer errored within 10 bytes (plus any gzip
      header metadata), a gzip.Write would erroneously report up to 10 bytes
      written that were not actually written of the input slice. This is
      especially problematic when the input slice is less than 10 bytes.
      
      The error came from counting the 10 header byte write. If writing the
      header is completely successful, the 10 bytes written is overridden by
      the flate write with the input slice.
      
      This removes counting the 10 required header bytes, and also changes the
      return to use zero until the slice is used.
      
      The old Write could return one byte written when it actually was not.
      This is difficult to verify because the smallest input slice is one
      byte; a test checking that the input slice was the byte written would be
      quite involved. Thankfully, gzip's minimum header write is 10 bytes. If
      we test that two bytes are not falsely written, we indirectly cover the
      one byte case.
      
      Fixes #24625
      
      Change-Id: I1c1f8cd791e0c4cffc22aa8acd95186582c832ba
      Reviewed-on: https://go-review.googlesource.com/103861Reviewed-by: 's avatarJoe Tsai <joetsai@google.com>
      Run-TryBot: Joe Tsai <joetsai@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f1deee0e
    • isharipo's avatar
      test/fixedbugs: fix bug248 and bug345 · b44e73ea
      isharipo authored
      When test/run script was removed, these two tests
      were changed to be executed by test/run.go.
      Because errchk does not exit with non-zero status on
      errors, they were silently failing for a while.
      
      This change makes 2 things:
      
      1. Compile tested packages in GOROOT/test to match older runner script
         behavior (strictly required only in bug345, optional in bug248)
      
      2. Check command output with "(?m)^BUG" regexp.
         It approximates older `grep -q '^BUG' that was used before.
      
      See referenced issue for detailed explanation.
      
      Fixes #24629
      
      Change-Id: Ie888dcdb4e25cdbb19d434bbc5cb03eb633e9ee8
      Reviewed-on: https://go-review.googlesource.com/104095
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      Reviewed-by: 's avatarEmmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b44e73ea
    • Matthew Dempsky's avatar
      cmd/compile: use newfuncname in dclfunc · 45ce10fa
      Matthew Dempsky authored
      Eliminates an inconsistency between user functions and generated
      functions.
      
      Passes toolstash-check.
      
      Change-Id: I946b511ca81d88a0024b5932cb50f3d8b9e808f4
      Reviewed-on: https://go-review.googlesource.com/103863
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      45ce10fa
    • Meng Zhuo's avatar
      crypto/md5: add assembly implementation on arm64 · b834cd9a
      Meng Zhuo authored
      This change improves the performance of the block
      function used within crypto/md5 on arm64.  The following
      improvement was seen:
      
      name                 old time/op    new time/op     delta
      Hash8Bytes             1.62µs ± 0%     0.85µs ± 0%  -47.83%  (p=0.000 n=8+10)
      Hash1K                 8.82µs ± 0%     7.10µs ± 3%  -19.52%  (p=0.000 n=10+10)
      Hash8K                 59.5µs ± 2%     50.2µs ± 0%  -15.63%  (p=0.000 n=9+10)
      Hash8BytesUnaligned    1.63µs ± 0%     0.85µs ± 0%  -47.92%  (p=0.000 n=9+10)
      Hash1KUnaligned        14.1µs ± 0%      7.4µs ± 0%  -47.45%  (p=0.000 n=9+10)
      Hash8KUnaligned         101µs ± 0%       53µs ± 0%  -47.57%  (p=0.000 n=10+10)
      
      name                 old speed      new speed       delta
      Hash8Bytes           4.93MB/s ± 0%   9.44MB/s ± 0%  +91.61%  (p=0.000 n=9+10)
      Hash1K                116MB/s ± 0%    144MB/s ± 3%  +24.28%  (p=0.000 n=10+10)
      Hash8K                138MB/s ± 2%    163MB/s ± 0%  +18.52%  (p=0.000 n=9+10)
      Hash8BytesUnaligned  4.92MB/s ± 0%   9.44MB/s ± 0%  +92.04%  (p=0.000 n=9+10)
      Hash1KUnaligned      72.8MB/s ± 0%  138.6MB/s ± 0%  +90.29%  (p=0.000 n=9+8)
      Hash8KUnaligned      80.9MB/s ± 0%  154.2MB/s ± 0%  +90.71%  (p=0.000 n=10+10)
      
      Change-Id: I9e121a3132ff1b59e30f2de64e46106269065ecd
      Reviewed-on: https://go-review.googlesource.com/101875Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      b834cd9a
    • Daniel Martí's avatar
      cmd: remove some unused parameters · 27226504
      Daniel Martí authored
      Change-Id: I9d2a4b8df324897e264d30801e95ddc0f0e75f3a
      Reviewed-on: https://go-review.googlesource.com/102337
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIlya Tocar <ilya.tocar@intel.com>
      27226504
    • Matthew Dempsky's avatar
      cmd/compile: refactor constant rewriting · 0250ef91
      Matthew Dempsky authored
      Extract all rewrite-to-OLITERAL expressions to use a single setconst
      helper function.
      
      Does not pass toolstash-check for two reasons:
      
      1) We now consistently clear Left/Right/etc when rewriting Nodes into
      OLITERALs, which results in their inlining complexity being correctly
      computed. So more functions can now be inlined.
      
      2) We preserve Pos, so PC line tables change somewhat.
      
      Change-Id: I2b5c293bee7c69c2ccd704677f5aba4ec40e3155
      Reviewed-on: https://go-review.googlesource.com/103860
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDaniel Martí <mvdan@mvdan.cc>
      0250ef91
  2. 01 Apr, 2018 5 commits
  3. 31 Mar, 2018 5 commits
  4. 30 Mar, 2018 13 commits
  5. 29 Mar, 2018 8 commits
    • Ben Burkert's avatar
      net: map context errors from aborted dial to internal net package errors · 72b0fb51
      Ben Burkert authored
      Map the error returned when a dial is aborted from the context package
      error to the internal net package error. For example, context.Canceled
      errors map to errCanceled, and context.DeadlineExceeded errors map to
      poll.ErrTimeout.
      
      Fixes #23648
      
      Change-Id: Idf9d3d08052d540740c0b054503aaed931dc5b1e
      Reviewed-on: https://go-review.googlesource.com/103518
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      72b0fb51
    • Joe Tsai's avatar
      os: add ModeIrregular flag · dfd7f356
      Joe Tsai authored
      There is currently no way for os.FileMode.IsRegular to report false
      without being one of the following types:
      	ModeDir | ModeSymlink | ModeNamedPipe | ModeSocket | ModeDevice
      
      This makes it difficult for custom implementations of os.FileInfo to return
      a Mode that is explicitly not regular without resorting to setting one
      of the types listed above. However, every one of the aforementioned types
      are ill-suited as a general-purpose "not regular" file type.
      
      Thus, add a ModeIrregular to serve exactly for that purpose.
      The ModeIrregular type carries no information other than the fact that the
      file is not regular.
      
      Updates #22903
      Fixes #23878
      
      Change-Id: I4f34d88f960bcb014816d8e7b5de8b1035077948
      Reviewed-on: https://go-review.googlesource.com/94856Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      dfd7f356
    • Wèi Cōngruì's avatar
      math: fix Ldexp when result is below ldexp(2, -1075) · 4b265fb7
      Wèi Cōngruì authored
      Before this change, the smallest result Ldexp can handle was
      ldexp(2, -1075), which is SmallestNonzeroFloat64.
      There are some numbers below it should also be rounded to
      SmallestNonzeroFloat64. The change fixes this.
      
      Fixes #23407
      
      Change-Id: I76f4cb005a6e9ccdd95b5e5c734079fd5d29e4aa
      Reviewed-on: https://go-review.googlesource.com/87338
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      4b265fb7
    • Ian Lance Taylor's avatar
      regexp/syntax: update perl script to preserve \s behavior · 9967582f
      Ian Lance Taylor authored
      Incorporate https://code-review.googlesource.com/#/c/re2/+/3050/ from
      the re2 repository. Description of that change:
      
          Preserve the original behaviour of \s.
      
          Prior to Perl 5.18, \s did not match vertical tab. Bake that into
          make_perl_groups.pl as an override so that perl_groups.cc retains
          its current definitions when rebuilt with newer versions of Perl.
      
      This fixes make_perl_groups.pl to generate an unchanged perl_groups.go
      with perl versions 5.18 and later.
      
      Fixes #22057
      
      Change-Id: I9a56e9660092ed6c1ff1045b4a3847de355441a7
      Reviewed-on: https://go-review.googlesource.com/103517
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      9967582f
    • Matthew Dempsky's avatar
      cmd/compile: refactor memory op constructors in SSA builder · 64bf9057
      Matthew Dempsky authored
      Pulling these operations out separately so it's easier to add
      instrumentation calls.
      
      Passes toolstash-check.
      
      Updates #19054.
      
      Change-Id: If6a537124a87bac2eceff1d66d9df5ebb3bf07be
      Reviewed-on: https://go-review.googlesource.com/102816Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      64bf9057
    • Alberto Donizetti's avatar
      test/codegen: match 387 ops too for GOARCH=386 · 56eaf574
      Alberto Donizetti authored
      Change-Id: I99407e27e340689009af798989b33cef7cb92070
      Reviewed-on: https://go-review.googlesource.com/103376
      Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
      Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      56eaf574
    • Alberto Donizetti's avatar
      test: avoid touching GOOS/GOARCH in codegen driver · aacf7a18
      Alberto Donizetti authored
      This change modifies the codegen test harness driver so that it no
      longer modifies the environment GOOS/GOARCH, since that seems to cause
      flakiness in other concurrently-running tests.
      
      The change also enables the codegen tests in run.go.
      
      Fixes #24538
      
      Change-Id: I997ac1eb38eb92054efff67fe5c4d3cccc86412b
      Reviewed-on: https://go-review.googlesource.com/103455
      Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      aacf7a18
    • Josh Bleecher Snyder's avatar
      cmd/compile: prefer to evict a rematerializable register · 014a9048
      Josh Bleecher Snyder authored
      This resolves a long-standing regalloc TODO:
      If you must evict a register, choose to evict a register
      containing a rematerializable value, since that value
      won't need to be spilled.
      
      Provides very minor performance and size improvements.
      
      name                     old time/op    new time/op    delta
      BinaryTree17-8              2.20s ± 3%     2.18s ± 2%  -0.77%  (p=0.000 n=45+49)
      Fannkuch11-8                2.14s ± 2%     2.15s ± 2%  +0.73%  (p=0.000 n=43+44)
      FmtFprintfEmpty-8          30.6ns ± 4%    30.2ns ± 3%  -1.14%  (p=0.000 n=50+48)
      FmtFprintfString-8         54.5ns ± 6%    53.6ns ± 5%  -1.64%  (p=0.001 n=50+48)
      FmtFprintfInt-8            58.0ns ± 7%    57.6ns ± 4%    ~     (p=0.220 n=50+50)
      FmtFprintfIntInt-8         85.3ns ± 2%    84.8ns ± 3%  -0.62%  (p=0.001 n=44+47)
      FmtFprintfPrefixedInt-8    93.9ns ± 6%    93.6ns ± 5%    ~     (p=0.706 n=50+48)
      FmtFprintfFloat-8           178ns ± 4%     177ns ± 4%    ~     (p=0.107 n=49+50)
      FmtManyArgs-8               376ns ± 4%     374ns ± 3%  -0.58%  (p=0.013 n=45+50)
      GobDecode-8                4.77ms ± 2%    4.76ms ± 3%    ~     (p=0.059 n=47+46)
      GobEncode-8                4.04ms ± 2%    3.99ms ± 3%  -1.13%  (p=0.000 n=49+49)
      Gzip-8                      177ms ± 2%     180ms ± 3%  +1.43%  (p=0.000 n=48+48)
      Gunzip-8                   28.5ms ± 6%    28.3ms ± 5%    ~     (p=0.104 n=50+49)
      HTTPClientServer-8         72.1µs ± 1%    72.0µs ± 1%  -0.15%  (p=0.042 n=48+42)
      JSONEncode-8               9.81ms ± 5%   10.03ms ± 6%  +2.29%  (p=0.000 n=50+49)
      JSONDecode-8               39.2ms ± 3%    39.3ms ± 2%    ~     (p=0.095 n=49+49)
      Mandelbrot200-8            3.48ms ± 2%    3.46ms ± 2%  -0.80%  (p=0.000 n=47+48)
      GoParse-8                  2.54ms ± 3%    2.51ms ± 3%  -1.35%  (p=0.000 n=49+49)
      RegexpMatchEasy0_32-8      66.0ns ± 7%    65.7ns ± 8%    ~     (p=0.331 n=50+50)
      RegexpMatchEasy0_1K-8       155ns ± 4%     154ns ± 4%    ~     (p=0.986 n=49+50)
      RegexpMatchEasy1_32-8      62.6ns ± 8%    62.2ns ± 5%    ~     (p=0.395 n=50+49)
      RegexpMatchEasy1_1K-8       260ns ± 5%     255ns ± 3%  -1.92%  (p=0.000 n=49+49)
      RegexpMatchMedium_32-8     92.9ns ± 2%    91.8ns ± 2%  -1.25%  (p=0.000 n=46+48)
      RegexpMatchMedium_1K-8     27.7µs ± 3%    27.0µs ± 2%  -2.59%  (p=0.000 n=49+49)
      RegexpMatchHard_32-8       1.23µs ± 4%    1.21µs ± 2%  -2.16%  (p=0.000 n=49+44)
      RegexpMatchHard_1K-8       36.4µs ± 2%    35.7µs ± 2%  -1.87%  (p=0.000 n=48+49)
      Revcomp-8                   274ms ± 2%     276ms ± 3%  +0.70%  (p=0.034 n=45+48)
      Template-8                 45.1ms ± 8%    45.1ms ± 8%    ~     (p=0.643 n=50+50)
      TimeParse-8                 223ns ± 2%     223ns ± 2%    ~     (p=0.401 n=47+47)
      TimeFormat-8                245ns ± 2%     246ns ± 3%    ~     (p=0.758 n=49+50)
      [Geo mean]                 36.5µs         36.3µs       -0.54%
      
      
      name        old object-bytes  new object-bytes  delta
      Template          480kB ± 0%        480kB ± 0%    ~     (all equal)
      Unicode           214kB ± 0%        214kB ± 0%    ~     (all equal)
      GoTypes          1.54MB ± 0%       1.54MB ± 0%  -0.03%  (p=0.008 n=5+5)
      Compiler         5.75MB ± 0%       5.75MB ± 0%    ~     (all equal)
      SSA              14.6MB ± 0%       14.6MB ± 0%  -0.01%  (p=0.008 n=5+5)
      Flate             300kB ± 0%        300kB ± 0%  -0.01%  (p=0.008 n=5+5)
      GoParser          366kB ± 0%        366kB ± 0%    ~     (all equal)
      Reflect          1.20MB ± 0%       1.20MB ± 0%    ~     (all equal)
      Tar               413kB ± 0%        413kB ± 0%    ~     (all equal)
      XML               529kB ± 0%        528kB ± 0%  -0.13%  (p=0.008 n=5+5)
      [Geo mean]        909kB             909kB       -0.02%
      
      
      Change-Id: I46d37a55197683a98913f35801dc2b0d609653c8
      Reviewed-on: https://go-review.googlesource.com/103240
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      014a9048