1. 30 Aug, 2016 12 commits
    • Martin Möhrmann's avatar
      cmd/compile: improve string iteration performance · 0dae9dfb
      Martin Möhrmann authored
      Generate a for loop for ranging over strings that only needs to call
      the runtime function charntorune for non ASCII characters.
      
      This provides faster iteration over ASCII characters and slightly
      faster iteration for other characters.
      
      The runtime function charntorune is changed to take an index from where
      to start decoding and returns the index after the last byte belonging
      to the decoded rune.
      
      All call sites of charntorune in the runtime are replaced by a for loop
      that will be transformed by the compiler instead of calling the charntorune
      function directly.
      
      go binary size decreases by 80 bytes.
      godoc binary size increases by around 4 kilobytes.
      
      runtime:
      
      name                           old time/op  new time/op  delta
      RuneIterate/range/ASCII-4      43.7ns ± 3%  10.3ns ± 4%  -76.33%  (p=0.000 n=44+45)
      RuneIterate/range/Japanese-4   72.5ns ± 2%  62.8ns ± 2%  -13.41%  (p=0.000 n=49+50)
      RuneIterate/range1/ASCII-4     43.5ns ± 2%  10.4ns ± 3%  -76.18%  (p=0.000 n=50+50)
      RuneIterate/range1/Japanese-4  72.5ns ± 2%  62.9ns ± 2%  -13.26%  (p=0.000 n=50+49)
      RuneIterate/range2/ASCII-4     43.5ns ± 3%  10.3ns ± 2%  -76.22%  (p=0.000 n=48+47)
      RuneIterate/range2/Japanese-4  72.4ns ± 2%  62.7ns ± 2%  -13.47%  (p=0.000 n=50+50)
      
      strings:
      
      name                 old time/op    new time/op    delta
      IndexRune-4            64.7ns ± 5%    22.4ns ± 3%  -65.43%  (p=0.000 n=25+21)
      MapNoChanges-4          269ns ± 2%     157ns ± 2%  -41.46%  (p=0.000 n=23+24)
      Fields-4               23.0ms ± 2%    19.7ms ± 2%  -14.35%  (p=0.000 n=25+25)
      FieldsFunc-4           23.1ms ± 2%    19.6ms ± 2%  -14.94%  (p=0.000 n=25+24)
      
      name                 old speed      new speed      delta
      Fields-4             45.6MB/s ± 2%  53.2MB/s ± 2%  +16.87%  (p=0.000 n=24+25)
      FieldsFunc-4         45.5MB/s ± 2%  53.5MB/s ± 2%  +17.57%  (p=0.000 n=25+24)
      
      Updates #13162
      
      Change-Id: I79ffaf828d82bf9887592f08e5cad883e9f39701
      Reviewed-on: https://go-review.googlesource.com/27853
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      Run-TryBot: Martin Möhrmann <martisch@uos.de>
      0dae9dfb
    • Keith Randall's avatar
      runtime: update a few comments · 0d7a2241
      Keith Randall authored
      noescape is now 0 instructions with the SSA backend.
      fast atomics are no longer a TODO (at least for amd64).
      
      Change-Id: Ib6e06f7471bef282a47ba236d8ce95404bb60a42
      Reviewed-on: https://go-review.googlesource.com/28087
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0d7a2241
    • Robert Griesemer's avatar
      cmd/compile: make internal objects directly print to printer · f7ac5da4
      Robert Griesemer authored
      Internal objects that satisfy the Printable interface can print
      directly to a printer w/o going through the conversion to a string
      first.
      
      Made printer.f understand and special-case %v so that Printable
      objects use the printer directly.
      
      This is work in progress and we may end up doing something else
      eventually (perhaps using fmt.Formatter) - or even undo these
      changes if this exploration doesn't get us to a significantly
      better place.
      
      Allocations numbers relative to commit c85b77c2 (still up, but
      reduced from most recent change):
      
      name       old time/op     new time/op     delta
      Template       307ms ± 4%      315ms ± 4%   +2.55%        (p=0.000 n=29+29)
      Unicode        164ms ± 4%      165ms ± 4%     ~           (p=0.057 n=30+30)
      GoTypes        1.01s ± 3%      1.03s ± 3%   +1.72%        (p=0.000 n=30+30)
      Compiler       5.49s ± 1%      5.62s ± 2%   +2.31%        (p=0.000 n=30+28)
      
      name       old user-ns/op  new user-ns/op  delta
      Template        397M ± 3%       406M ± 6%   +2.21%        (p=0.000 n=28+30)
      Unicode         225M ± 4%       226M ± 3%     ~           (p=0.230 n=29+30)
      GoTypes        1.31G ± 3%      1.34G ± 5%   +2.79%        (p=0.000 n=30+30)
      Compiler       7.39G ± 2%      7.50G ± 2%   +1.43%        (p=0.000 n=30+29)
      
      name       old alloc/op    new alloc/op    delta
      Template      46.8MB ± 0%     47.5MB ± 0%   +1.48%        (p=0.000 n=29+28)
      Unicode       37.8MB ± 0%     38.1MB ± 0%   +0.64%        (p=0.000 n=30+28)
      GoTypes        143MB ± 0%      145MB ± 0%   +1.72%        (p=0.000 n=30+30)
      Compiler       683MB ± 0%      706MB ± 0%   +3.31%        (p=0.000 n=30+29)
      
      name       old allocs/op   new allocs/op   delta
      Template        444k ± 0%       481k ± 0%   +8.38%        (p=0.000 n=30+30)
      Unicode         369k ± 0%       379k ± 0%   +2.74%        (p=0.000 n=30+30)
      GoTypes        1.35M ± 0%      1.50M ± 0%  +10.78%        (p=0.000 n=30+30)
      Compiler       5.66M ± 0%      6.25M ± 0%  +10.31%        (p=0.000 n=29+29)
      
      For #16897.
      
      Change-Id: I37f95ab60508018ee6d29a98d238482b60e3e4b5
      Reviewed-on: https://go-review.googlesource.com/28072Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      f7ac5da4
    • Terrel Shumway's avatar
      doc: clarify FAQ wording for float sizes · fcb45e7c
      Terrel Shumway authored
      I was confused by the current wording. This wording
      answers the question more clearly.
      
      Thanks to Robert Griesemer for suggestions.
      
      Fixes #16916
      
      Change-Id: I50187c8df2db661b9581f4b3c5d5c279d2f9af41
      Reviewed-on: https://go-review.googlesource.com/28052Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      fcb45e7c
    • Keith Randall's avatar
      cmd/compile: intrinsify sync/atomic for amd64 · d6098e42
      Keith Randall authored
      Uses the same implementation as runtime/internal/atomic.
      
      Reorganize the intrinsic detector to make it more table-driven.
      
      Also works on amd64p32.
      
      Change-Id: I7a5238951d6018d7d5d1bc01f339f6ee9282b2d0
      Reviewed-on: https://go-review.googlesource.com/28076Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      d6098e42
    • Dave Cheney's avatar
      reflect: avoid zeroing memory that will be overwritten · adb1e67f
      Dave Cheney authored
      Avoid new'ing memory that will be overwritten by assignment.
      
      name              old time/op    new time/op    delta
      Call-4               160ns ± 4%     155ns ± 2%  -3.19%        (p=0.003 n=10+10)
      FieldByName1-4      94.5ns ± 2%    95.2ns ± 1%  +0.65%          (p=0.026 n=9+9)
      FieldByName2-4      3.09µs ± 4%    3.13µs ± 2%    ~           (p=0.165 n=10+10)
      FieldByName3-4      19.8µs ± 1%    19.9µs ± 1%    ~            (p=0.395 n=10+8)
      InterfaceBig-4      11.6ns ± 0%    11.7ns ± 0%  +0.86%          (p=0.000 n=8+9)
      InterfaceSmall-4    11.7ns ± 0%    11.7ns ± 0%    ~     (all samples are equal)
      New-4               26.6ns ± 0%    26.4ns ± 0%  -0.64%         (p=0.000 n=10+9)
      
      name              old alloc/op   new alloc/op   delta
      Call-4              0.00B ±NaN%    0.00B ±NaN%    ~     (all samples are equal)
      
      name              old allocs/op  new allocs/op  delta
      Call-4               0.00 ±NaN%     0.00 ±NaN%    ~     (all samples are equal)
      
      Change-Id: I12c85d4e65245598669dd6f66beb0744ec9b9d6d
      Reviewed-on: https://go-review.googlesource.com/28011
      Run-TryBot: Dave Cheney <dave@cheney.net>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      adb1e67f
    • Brad Fitzpatrick's avatar
      cmd/go: make C compiler warnings fatal on builders · b6e3a98c
      Brad Fitzpatrick authored
      Fixes #14698
      
      Change-Id: I82fa781bf136c30e900d8e910ff576ba8b218acb
      Reviewed-on: https://go-review.googlesource.com/23005
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b6e3a98c
    • Brad Fitzpatrick's avatar
      net/http: stop timeout timer if user cancels a request · 2af00eb6
      Brad Fitzpatrick authored
      Change-Id: I84faeae69f294b9a70e545faac6a070feba67770
      Reviewed-on: https://go-review.googlesource.com/28074
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      2af00eb6
    • Jonathan Boulle's avatar
      os: fix typo in comment (Readir -> Readdir) · 6f43a989
      Jonathan Boulle authored
      Change-Id: I8434925661dc11396380af65c192c9f0dc191287
      Reviewed-on: https://go-review.googlesource.com/27973Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      6f43a989
    • Brad Fitzpatrick's avatar
      all: use time.Until where applicable · 298791a9
      Brad Fitzpatrick authored
      Updates #14595
      
      Change-Id: Idf60b3004c7a0ebb59dd48389ab62c854069e09f
      Reviewed-on: https://go-review.googlesource.com/28073
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      298791a9
    • Josh Bleecher Snyder's avatar
      go/types: fix bad variable shadowing in offsetsof · 6c6ad08e
      Josh Bleecher Snyder authored
      Introduced in CL 26995.
      
      Fixes #16902
      
      Change-Id: I8e749f598167e1f8b82cd5e735a7eb5291362e5e
      Reviewed-on: https://go-review.googlesource.com/28070
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      6c6ad08e
    • Sam Whited's avatar
      time: Add Until helper function · 67ea7107
      Sam Whited authored
      Adds an Until() function that returns the duration until the given time.
      This compliments the existing Since() function and makes writing
      expressions that have expiration times more readable; for example:
      
          <-After(time.Until(connExpires)):
      
      Fixes #14595
      
      Change-Id: I87998a924b11d4dad5512e010b29d2da6b123456
      Reviewed-on: https://go-review.googlesource.com/20118
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      67ea7107
  2. 29 Aug, 2016 20 commits
  3. 28 Aug, 2016 6 commits
    • Cherry Zhang's avatar
      cmd/compile: fix load int32 to FP register on big-endian MIPS64 · 2f679d74
      Cherry Zhang authored
      Fixes #16903.
      
      Change-Id: I1f6fcd57e14b2b62e208b7bb3adccd5fd7f8bdbc
      Reviewed-on: https://go-review.googlesource.com/27933
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMinux Ma <minux@golang.org>
      2f679d74
    • Radu Berinde's avatar
      hash/crc32: fix nil Castagnoli table problem · 8c15a172
      Radu Berinde authored
      When SSE is available, we don't need the Table. However, it is
      returned as a handle by MakeTable. Fix this to always generate
      the table.
      
      Further cleanup is discussed in #16909.
      
      Change-Id: Ic05400d68c6b5d25073ebd962000451746137afc
      Reviewed-on: https://go-review.googlesource.com/27934Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8c15a172
    • Keith Randall's avatar
      cmd/compile: fix noopt build · 0c6c3d1d
      Keith Randall authored
      Atomic add rules were depending on CSE to combine duplicate atomic ops.
      With -N, CSE doesn't run.
      
      Redo the rules for atomic add so there's only one atomic op.
      Introduce an add-to-first-part-of-tuple pseudo-ops to make the atomic add result correct.
      
      Change-Id: Ib132247051abe5f80fefad6c197db8df8ee06427
      Reviewed-on: https://go-review.googlesource.com/27991
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      0c6c3d1d
    • Keith Randall's avatar
      cmd/compile: intrinsify the rest of runtime/internal/atomic for amd64 · 84aac622
      Keith Randall authored
      Atomic swap, add/and/or, compare and swap.
      
      Also works on amd64p32.
      
      Change-Id: Idf2d8f3e1255f71deba759e6e75e293afe4ab2ba
      Reviewed-on: https://go-review.googlesource.com/27813Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      84aac622
    • Alex Brainman's avatar
      time: always use $GOROOT/lib/time/zoneinfo.zip with genzabbrs.go · e2e2d10b
      Alex Brainman authored
      genzabbrs.go uses whatever zoneinfo database available on the system.
      This makes genzabbrs.go output change from system to system. Adjust
      go:generate line to always use $GOROOT/lib/time/zoneinfo.zip, so it
      does not matter who runs the command.
      
      Also move go:generate line into zoneinfo.go, so it can be run
      on Unix (see #16368 for details).
      
      Fixes #15802.
      
      Change-Id: I8ae4818aaf40795364e180d7bb4326ad7c07c370
      Reviewed-on: https://go-review.googlesource.com/27832Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e2e2d10b
    • Radu Berinde's avatar
      hash/crc32: improve the AMD64 implementation using SSE4.2 · 90c3cf4b
      Radu Berinde authored
      The algorithm is explained in the comments. The improvement in
      throughput is about 1.4x for buffers between 500b-4Kb and 2.5x-2.6x
      for larger buffers.
      
      Additionally, we no longer initialize the software tables if SSE4.2 is
      available.
      
      Adding a test for the SSE implementation (restricted to amd64 and
      amd64p32).
      
      Benchmarks on a Haswell i5-4670 @ 3.4 GHz:
      
      name                           old time/op    new time/op     delta
      CastagnoliCrc15B-4               21.9ns ± 1%     22.9ns ± 0%    +4.45%
      CastagnoliCrc15BMisaligned-4     22.6ns ± 0%     23.4ns ± 0%    +3.43%
      CastagnoliCrc40B-4               23.3ns ± 0%     23.9ns ± 0%    +2.58%
      CastagnoliCrc40BMisaligned-4     25.4ns ± 0%     26.1ns ± 0%    +2.86%
      CastagnoliCrc512-4               72.6ns ± 0%     52.8ns ± 0%   -27.33%
      CastagnoliCrc512Misaligned-4     76.3ns ± 1%     56.3ns ± 0%   -26.18%
      CastagnoliCrc1KB-4                128ns ± 1%       89ns ± 0%   -30.04%
      CastagnoliCrc1KBMisaligned-4      130ns ± 0%       88ns ± 0%   -32.65%
      CastagnoliCrc4KB-4                461ns ± 0%      187ns ± 0%   -59.40%
      CastagnoliCrc4KBMisaligned-4      463ns ± 0%      191ns ± 0%   -58.77%
      CastagnoliCrc32KB-4              3.58µs ± 0%     1.35µs ± 0%   -62.22%
      CastagnoliCrc32KBMisaligned-4    3.58µs ± 0%     1.36µs ± 0%   -61.84%
      
      name                           old speed      new speed       delta
      CastagnoliCrc15B-4              684MB/s ± 1%    655MB/s ± 0%    -4.32%
      CastagnoliCrc15BMisaligned-4    663MB/s ± 0%    641MB/s ± 0%    -3.32%
      CastagnoliCrc40B-4             1.72GB/s ± 0%   1.67GB/s ± 0%    -2.69%
      CastagnoliCrc40BMisaligned-4   1.58GB/s ± 0%   1.53GB/s ± 0%    -2.82%
      CastagnoliCrc512-4             7.05GB/s ± 0%   9.70GB/s ± 0%   +37.59%
      CastagnoliCrc512Misaligned-4   6.71GB/s ± 1%   9.09GB/s ± 0%   +35.43%
      CastagnoliCrc1KB-4             7.98GB/s ± 1%  11.46GB/s ± 0%   +43.55%
      CastagnoliCrc1KBMisaligned-4   7.86GB/s ± 0%  11.70GB/s ± 0%   +48.75%
      CastagnoliCrc4KB-4             8.87GB/s ± 0%  21.80GB/s ± 0%  +145.69%
      CastagnoliCrc4KBMisaligned-4   8.83GB/s ± 0%  21.39GB/s ± 0%  +142.25%
      CastagnoliCrc32KB-4            9.15GB/s ± 0%  24.22GB/s ± 0%  +164.62%
      CastagnoliCrc32KBMisaligned-4  9.16GB/s ± 0%  24.00GB/s ± 0%  +161.94%
      
      Fixes #16107.
      
      Change-Id: Ibe50ea76574674ce0571ef31c31015e0ed66b907
      Reviewed-on: https://go-review.googlesource.com/27931
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      90c3cf4b
  4. 27 Aug, 2016 2 commits