1. 25 Mar, 2019 3 commits
  2. 24 Mar, 2019 3 commits
    • sergey's avatar
      net/url: check for lowercase before uppercase in shouldEscape · c7bb4533
      sergey authored
      Most chars in URLs are lowercase, so check that first.
      
      Performance change:
      
      String-4               7.62µs ± 1%    7.27µs ± 3%  -4.61%  (p=0.008 n=5+5)
      QueryEscape/#00-4      92.6ns ± 3%    90.3ns ± 1%  -2.48%  (p=0.016 n=5+5)
      QueryEscape/#01-4       515ns ± 4%     510ns ± 2%    ~     (p=0.683 n=5+5)
      QueryEscape/#02-4       375ns ± 1%     343ns ± 1%  -8.52%  (p=0.008 n=5+5)
      QueryEscape/#03-4       758ns ± 1%     699ns ± 1%  -7.83%  (p=0.008 n=5+5)
      QueryEscape/#04-4      6.06µs ± 1%    5.74µs ± 1%  -5.38%  (p=0.008 n=5+5)
      PathEscape/#00-4        140ns ± 1%     135ns ± 2%  -3.85%  (p=0.008 n=5+5)
      PathEscape/#01-4        511ns ± 3%     507ns ± 3%    ~     (p=0.587 n=5+5)
      PathEscape/#02-4        372ns ± 1%     342ns ± 2%  -8.22%  (p=0.008 n=5+5)
      PathEscape/#03-4        747ns ± 1%     685ns ± 1%  -8.30%  (p=0.008 n=5+5)
      PathEscape/#04-4       5.94µs ± 1%    5.64µs ± 3%  -4.98%  (p=0.008 n=5+5)
      QueryUnescape/#00-4     111ns ± 4%     110ns ± 2%    ~     (p=0.952 n=5+5)
      QueryUnescape/#01-4     390ns ± 0%     391ns ± 2%    ~     (p=0.714 n=5+5)
      QueryUnescape/#02-4     297ns ± 5%     295ns ± 3%    ~     (p=0.524 n=5+5)
      QueryUnescape/#03-4     543ns ± 3%     556ns ± 2%  +2.39%  (p=0.032 n=5+5)
      QueryUnescape/#04-4    3.23µs ± 3%    3.22µs ± 2%    ~     (p=1.000 n=5+5)
      PathUnescape/#00-4      111ns ± 1%     110ns ± 3%    ~     (p=0.881 n=5+5)
      PathUnescape/#01-4      389ns ± 2%     386ns ± 2%    ~     (p=0.444 n=5+5)
      PathUnescape/#02-4      297ns ± 1%     295ns ± 3%    ~     (p=0.738 n=5+5)
      PathUnescape/#03-4      557ns ± 3%     553ns ± 2%    ~     (p=0.810 n=5+5)
      PathUnescape/#04-4     2.94µs ± 2%    2.97µs ± 2%    ~     (p=0.222 n=5+5)
      
      Change-Id: I7e6d64cd5f8f5218cb40f52f0015168a8674aabb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168883Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c7bb4533
    • Alex Brainman's avatar
      cmd/go: keep WINDIR during TestScript · 7722f6d2
      Alex Brainman authored
      TestScript executes PowerShell. And PowerShell appears to require
      WINDIR environment variable to exists on windows-arm.
      
      So keep WINDIR environment variable when running PowerShell.
      
      Fixes #30711
      
      Change-Id: I14dde6614347325a8f3caf994ea8ab05294450a5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168859
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      7722f6d2
    • Daniel Martí's avatar
      text/template: allow using -}} with many spaces · e770b5b3
      Daniel Martí authored
      lexSpace consumed all spaces, even if the last one was part of a right
      delimiter like " -}}". Thus, "3  -}}" wouldn't lex as "3" and a right
      delimiter, but as "3", "-", and "}}".
      
      To fix that, make lexSpace stop if it encounters a right delimiter.
      
      Fixes #30948.
      
      Change-Id: I80a5546e5809e54f6823e2bf3a57a7e8808329be
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168457Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      e770b5b3
  3. 23 Mar, 2019 3 commits
  4. 22 Mar, 2019 14 commits
  5. 21 Mar, 2019 14 commits
  6. 20 Mar, 2019 3 commits
    • Josh Bleecher Snyder's avatar
      testing: stop rounding b.N · 03a79e94
      Josh Bleecher Snyder authored
      The original goal of rounding to readable b.N
      was to make it easier to eyeball times.
      However, proper analysis requires tooling
      (such as benchstat) anyway.
      
      Instead, take b.N as it comes.
      This will reduce the impact of external noise
      such as GC on benchmarks.
      
      This requires reworking our iteration estimates.
      We used to calculate the estimated ns/op
      and then divide our target ns by that estimate.
      However, this order of operations was destructive
      when the ns/op was very small; rounding could
      hide almost an order of magnitude of variation.
      Instead, multiply first, then divide.
      Also, make n an int64 to avoid overflow.
      
      Prior to this change, we attempted to cap b.N at 1e9.
      Due to rounding up, it was possible to get b.N as high as 2e9.
      This change consistently enforces the 1e9 cap.
      
      This change also reduces the wall time required to run benchmarks.
      
      Here's the impact of this change on the wall time to run
      all benchmarks once with benchtime=1s on some std packages:
      
      name           old time/op       new time/op       delta
      bytes                 306s ± 1%         238s ± 1%  -22.24%  (p=0.000 n=10+10)
      encoding/json         112s ± 8%          99s ± 7%  -11.64%  (p=0.000 n=10+10)
      net/http             54.7s ± 7%        44.9s ± 4%  -17.94%  (p=0.000 n=10+9)
      runtime               957s ± 1%         714s ± 0%  -25.38%  (p=0.000 n=10+9)
      strings               262s ± 1%         201s ± 1%  -23.27%  (p=0.000 n=10+10)
      [Geo mean]            216s              172s       -20.23%
      
      Updates #24735
      
      Change-Id: I7e38efb8e23c804046bf4fc065b3f5f3991d0a15
      Reviewed-on: https://go-review.googlesource.com/c/go/+/112155Reviewed-by: default avatarAustin Clements <austin@google.com>
      03a79e94
    • Carlos Eduardo Seo's avatar
      cmd/compile/internal, cmd/internal/obj/ppc64: generate new count trailing... · 3023d7da
      Carlos Eduardo Seo authored
      cmd/compile/internal, cmd/internal/obj/ppc64: generate new count trailing zeros instructions on POWER9
      
      This change adds new POWER9 instructions for counting trailing zeros (CNTTZW/CNTTZD)
      to the assembler and generates them in SSA when GOPPC64=power9.
      
      name                 old time/op  new time/op  delta
      TrailingZeros-160    1.59ns ±20%  1.45ns ±10%  -8.81%  (p=0.000 n=14+13)
      TrailingZeros8-160   1.55ns ±23%  1.62ns ±44%    ~     (p=0.593 n=13+15)
      TrailingZeros16-160  1.78ns ±23%  1.62ns ±38%  -9.31%  (p=0.003 n=14+14)
      TrailingZeros32-160  1.64ns ±10%  1.49ns ± 9%  -9.15%  (p=0.000 n=13+14)
      TrailingZeros64-160  1.53ns ± 6%  1.45ns ± 5%  -5.38%  (p=0.000 n=15+13)
      
      Change-Id: I365e6ff79f3ce4d8ebe089a6a86b1771853eb596
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167517Reviewed-by: default avatarLynn Boger <laboger@linux.vnet.ibm.com>
      3023d7da
    • Josh Bleecher Snyder's avatar
      cmd/compile: port callnew to ssa conversion · 23b476a3
      Josh Bleecher Snyder authored
      This is part of a general effort to shrink walk.
      In an ideal world, we'd have an SSA op for allocation,
      but we don't yet have a good mechanism for introducing
      function calling during SSA compilation.
      In the meantime, SSA conversion is a better place for it.
      
      This also makes it easier to introduce new optimizations;
      instead of doing the typecheck walk dance,
      we can simply write what we want the backend to do.
      
      I introduced a new opcode in this change because:
      
      (a) It avoids a class of bugs involving correctly detecting
          whether this ONEW is a "before walk" ONEW or an "after walk" ONEW.
          It also means that using ONEW or ONEWOBJ in the wrong context
          will generally result in a faster failure.
      (b) Opcodes are cheap.
      (c) It provides a better place to put documentation.
      
      This change also is also marginally more performant:
      
      name        old alloc/op      new alloc/op      delta
      Template         39.1MB ± 0%       39.0MB ± 0%  -0.14%  (p=0.008 n=5+5)
      Unicode          28.4MB ± 0%       28.4MB ± 0%    ~     (p=0.421 n=5+5)
      GoTypes           132MB ± 0%        132MB ± 0%  -0.23%  (p=0.008 n=5+5)
      Compiler          608MB ± 0%        607MB ± 0%  -0.25%  (p=0.008 n=5+5)
      SSA              2.04GB ± 0%       2.04GB ± 0%  -0.01%  (p=0.008 n=5+5)
      Flate            24.4MB ± 0%       24.3MB ± 0%  -0.13%  (p=0.008 n=5+5)
      GoParser         29.3MB ± 0%       29.1MB ± 0%  -0.54%  (p=0.008 n=5+5)
      Reflect          84.8MB ± 0%       84.7MB ± 0%  -0.21%  (p=0.008 n=5+5)
      Tar              36.7MB ± 0%       36.6MB ± 0%  -0.10%  (p=0.008 n=5+5)
      XML              48.7MB ± 0%       48.6MB ± 0%  -0.24%  (p=0.008 n=5+5)
      [Geo mean]       85.0MB            84.8MB       -0.19%
      
      name        old allocs/op     new allocs/op     delta
      Template           383k ± 0%         382k ± 0%  -0.26%  (p=0.008 n=5+5)
      Unicode            341k ± 0%         341k ± 0%    ~     (p=0.579 n=5+5)
      GoTypes           1.37M ± 0%        1.36M ± 0%  -0.39%  (p=0.008 n=5+5)
      Compiler          5.59M ± 0%        5.56M ± 0%  -0.49%  (p=0.008 n=5+5)
      SSA               16.9M ± 0%        16.9M ± 0%  -0.03%  (p=0.008 n=5+5)
      Flate              238k ± 0%         238k ± 0%  -0.23%  (p=0.008 n=5+5)
      GoParser           306k ± 0%         303k ± 0%  -0.93%  (p=0.008 n=5+5)
      Reflect            990k ± 0%         987k ± 0%  -0.33%  (p=0.008 n=5+5)
      Tar                356k ± 0%         355k ± 0%  -0.20%  (p=0.008 n=5+5)
      XML                444k ± 0%         442k ± 0%  -0.45%  (p=0.008 n=5+5)
      [Geo mean]         848k              845k       -0.33%
      
      Change-Id: I2c36003a7cbf71b53857b7de734852b698f49310
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167957
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      23b476a3