1. 20 May, 2019 1 commit
    • smasher164's avatar
      math/bits: make Add and Sub fallbacks constant time · 5ca44dc4
      smasher164 authored
      Make the extended precision add-with-carry and sub-with-carry operations
      take a constant amount of time to execute, regardless of input.
      
      name             old time/op  new time/op  delta
      Add-4            1.16ns ±11%  1.51ns ± 5%  +30.52%  (p=0.008 n=5+5)
      Add32-4          1.08ns ± 0%  1.03ns ± 1%   -4.86%  (p=0.029 n=4+4)
      Add64-4          1.09ns ± 1%  1.95ns ± 3%  +79.23%  (p=0.008 n=5+5)
      Add64multiple-4  4.03ns ± 1%  4.55ns ±11%  +13.07%  (p=0.008 n=5+5)
      Sub-4            1.08ns ± 1%  1.50ns ± 0%  +38.17%  (p=0.016 n=5+4)
      Sub32-4          1.09ns ± 2%  1.53ns ±10%  +40.26%  (p=0.008 n=5+5)
      Sub64-4          1.10ns ± 1%  1.47ns ± 1%  +33.39%  (p=0.008 n=5+5)
      Sub64multiple-4  4.30ns ± 2%  4.08ns ± 4%   -5.07%  (p=0.032 n=5+5)
      
      Fixes #31267
      
      Change-Id: I1824b1b3ab8f09902ce8b5fef84ce2fdb8847ed9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170758Reviewed-by: default avatarFilippo Valsorda <filippo@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5ca44dc4
  2. 17 May, 2019 12 commits
  3. 16 May, 2019 20 commits
  4. 15 May, 2019 7 commits
    • Damien Neil's avatar
      fmt: support %w · 14491a2e
      Damien Neil authored
      When fmt.Errorf is provided with a %w verb with an error operand,
      return an error implementing an Unwrap method returning that operand.
      
      It is invalid to use %w with other formatting functions, to use %w
      multiple times in a format string, or to use %w with a non-error
      operand. When the Errorf format string contains an invalid use of %w,
      the returned error does not implement Unwrap.
      
      Change-Id: I534e20d3b163ab22c2b137b1c9095906dc243221
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176998Reviewed-by: default avatarMarcel van Lohuizen <mpvl@golang.org>
      14491a2e
    • Damien Neil's avatar
      errors, fmt: revert rejected changes for Go 1.13 · 3e2c522d
      Damien Neil authored
      Reverts the following changes:
      
        https://go.googlesource.com/go/+/1f90d081391d4f5911960fd28d81d7ea5e554a8f
        https://go.googlesource.com/go/+/8bf18b56a47a98b9dd2fa03beb358312237a8c76
        https://go.googlesource.com/go/+/5402854c3557f87fa2741a52ffc15dfb1ef333cc
        https://go.googlesource.com/go/+/37f84817247d3b8e687a701ccb0d6bc7ffe3cb78
        https://go.googlesource.com/go/+/6be6f114e0d483a233101a67c9644cd72bd3ae7a
      
      Partially reverts the followinng change, removing the errors.Opaque
      function and the errors.Wrapper type definition:
      
        https://go.googlesource.com/go/+/62f5e8156ef56fa61e6af56f4ccc633bde1a9120
      
      Updates documentation referencing the Wrapper type.
      
      Change-Id: Ia622883e39cafb06809853e3fd90b21441124534
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176997
      Run-TryBot: Damien Neil <dneil@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMarcel van Lohuizen <mpvl@golang.org>
      3e2c522d
    • Filippo Valsorda's avatar
      crypto/x509: add support for Ed25519 certificates and keys · 599ec772
      Filippo Valsorda authored
      Based on RFC 8410.
      
      Updates #25355
      
      Change-Id: If7abb7eeb0ede10a9bb3d2004f2116e587c6207a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/175478
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAdam Langley <agl@golang.org>
      599ec772
    • Joel Sing's avatar
      syscall: implement rawVforkSyscall for linux/ppc64x and linux/s390x · ab242dcb
      Joel Sing authored
      This allows the use of CLONE_VFORK and CLONE_VM for fork/exec, preventing
      "fork/exec ...: cannot allocate memory" failures from occuring when attempting
      to execute commands from a Go process that has a large memory footprint.
      Additionally, this should reduce the latency of fork/exec on these platforms.
      
      The same problem was addressed on linux/amd64 via issue #5838.
      
      Updates #31936
      
      Change-Id: I7ae0fbbeaa29cab944a49a11272a380d497eb2d0
      Reviewed-on: https://go-review.googlesource.com/c/go/+/175697
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      ab242dcb
    • Russ Cox's avatar
      cmd/go: do not build test packages unnecessarily during go vet · 38431f10
      Russ Cox authored
      Vet needs export data for the imports of the package it is analyzing.
      Vet does not need export data for the package itself, since vet will
      do its own type checking. Assuming that vet is just as good as the compiler
      at detecting invalid programs, don't run the compiler unnecessarily.
      
      This especially matters for tests without external test files or for
      which the external test files do not import the test-augmented original
      package. In that case, the test-augmented original package need not
      be compiled at all.
      
      Cuts time for 'go clean -cache && go vet -x cmd/compile/internal/ssa'
      from 7.6r 24.3u 2.8s to 3.5r 8.5u 1.9s, by not running the compiler
      on the augmented test package.
      
      There is still more to be done here - if we do need to build a
      test-augmented package, we rerun cgo unnecessarily.
      But this is a big help.
      
      Cuts time for 'go vet std cmd' by about 30%.
      
      For #31916.
      
      Change-Id: If6136b4d384f1da77aed90b43f1a6b95f09b5d86
      Reviewed-on: https://go-review.googlesource.com/c/go/+/176438
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      38431f10
    • Russ Cox's avatar
      cmd/vendor: go get -u golang.org/x/tools && go mod vendor · ba23fa48
      Russ Cox authored
      Picks up vet fix from CL 176357.
      
      Change-Id: Ia77cd4a582c4edfbe59bbc311e6ce14046df0e83
      Reviewed-on: https://go-review.googlesource.com/c/go/+/177137
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ba23fa48
    • Sylvain Zimmer's avatar
      regexp: optimize for provably too short inputs · 8116599f
      Sylvain Zimmer authored
      For many patterns we can compute the minimum input length at compile time.
      If the input is shorter, we can return early and get a huge speedup.
      
      As pointed out by Damian Gryski, Perl's regex engine contains a number of
      these kinds of fail-fast optimizations:
      https://perldoc.perl.org/perlreguts.html#Peep-hole-Optimisation-and-Analysis
      
      Benchmarks: (including new ones for compile time)
      
      name               old time/op    new time/op    delta
      Compile/Onepass-8    4.39µs ± 1%    4.40µs ± 0%  +0.34%  (p=0.029 n=9+8)
      Compile/Medium-8     9.80µs ± 0%    9.91µs ± 0%  +1.17%  (p=0.000 n=10+10)
      Compile/Hard-8       72.7µs ± 0%    73.5µs ± 0%  +1.10%  (p=0.000 n=9+10)
      
      name                       old time/op    new time/op      delta
      Match/Easy0/16-8             52.6ns ± 5%       4.9ns ± 0%     -90.68%  (p=0.000 n=10+9)
      Match/Easy0/32-8             64.1ns ±10%      61.4ns ± 1%        ~     (p=0.188 n=10+9)
      Match/Easy0/1K-8              280ns ± 1%       277ns ± 2%      -0.97%  (p=0.004 n=10+10)
      Match/Easy0/32K-8            4.61µs ± 1%      4.55µs ± 1%      -1.49%  (p=0.000 n=9+10)
      Match/Easy0/1M-8              229µs ± 0%       226µs ± 1%      -1.29%  (p=0.000 n=8+10)
      Match/Easy0/32M-8            7.50ms ± 1%      7.47ms ± 1%        ~     (p=0.165 n=10+10)
      Match/Easy0i/16-8             533ns ± 1%         5ns ± 2%     -99.07%  (p=0.000 n=10+10)
      Match/Easy0i/32-8             950ns ± 0%       950ns ± 1%        ~     (p=0.920 n=10+9)
      Match/Easy0i/1K-8            27.5µs ± 1%      27.5µs ± 0%        ~     (p=0.739 n=10+10)
      Match/Easy0i/32K-8           1.13ms ± 0%      1.13ms ± 1%        ~     (p=0.079 n=9+10)
      Match/Easy0i/1M-8            36.7ms ± 2%      36.1ms ± 0%      -1.64%  (p=0.000 n=10+9)
      Match/Easy0i/32M-8            1.17s ± 0%       1.16s ± 1%      -0.80%  (p=0.004 n=8+9)
      Match/Easy1/16-8             55.5ns ± 6%       4.9ns ± 1%     -91.19%  (p=0.000 n=10+9)
      Match/Easy1/32-8             58.3ns ± 8%      56.6ns ± 1%        ~     (p=0.449 n=10+8)
      Match/Easy1/1K-8              750ns ± 0%       748ns ± 1%        ~     (p=0.072 n=8+10)
      Match/Easy1/32K-8            31.8µs ± 0%      31.6µs ± 1%      -0.50%  (p=0.035 n=10+9)
      Match/Easy1/1M-8             1.10ms ± 1%      1.09ms ± 0%      -0.95%  (p=0.000 n=10+9)
      Match/Easy1/32M-8            35.5ms ± 0%      35.2ms ± 1%      -1.05%  (p=0.000 n=9+10)
      Match/Medium/16-8             442ns ± 2%         5ns ± 1%     -98.89%  (p=0.000 n=10+10)
      Match/Medium/32-8             875ns ± 0%       878ns ± 1%        ~     (p=0.071 n=9+10)
      Match/Medium/1K-8            26.1µs ± 0%      25.9µs ± 0%      -0.64%  (p=0.000 n=10+10)
      Match/Medium/32K-8           1.09ms ± 1%      1.08ms ± 0%      -0.84%  (p=0.000 n=10+9)
      Match/Medium/1M-8            34.9ms ± 0%      34.6ms ± 1%      -0.98%  (p=0.000 n=9+10)
      Match/Medium/32M-8            1.12s ± 1%       1.11s ± 1%      -0.98%  (p=0.000 n=10+9)
      Match/Hard/16-8               721ns ± 1%         5ns ± 0%     -99.32%  (p=0.000 n=10+9)
      Match/Hard/32-8              1.32µs ± 1%      1.31µs ± 0%      -0.71%  (p=0.000 n=9+9)
      Match/Hard/1K-8              39.8µs ± 1%      39.7µs ± 1%        ~     (p=0.165 n=10+10)
      Match/Hard/32K-8             1.57ms ± 0%      1.56ms ± 0%      -0.70%  (p=0.000 n=10+9)
      Match/Hard/1M-8              50.4ms ± 1%      50.1ms ± 1%      -0.57%  (p=0.007 n=10+10)
      Match/Hard/32M-8              1.62s ± 1%       1.60s ± 0%      -0.98%  (p=0.000 n=10+10)
      Match/Hard1/16-8             3.88µs ± 1%      3.86µs ± 0%        ~     (p=0.118 n=10+10)
      Match/Hard1/32-8             7.44µs ± 1%      7.46µs ± 1%        ~     (p=0.109 n=10+10)
      Match/Hard1/1K-8              232µs ± 1%       229µs ± 1%      -1.31%  (p=0.000 n=10+9)
      Match/Hard1/32K-8            7.41ms ± 2%      7.41ms ± 0%        ~     (p=0.237 n=10+8)
      Match/Hard1/1M-8              238ms ± 1%       238ms ± 0%        ~     (p=0.481 n=10+10)
      Match/Hard1/32M-8             7.69s ± 1%       7.61s ± 0%      -1.00%  (p=0.000 n=10+10)
      
      Fixes #31329
      
      Change-Id: I04640e8c59178ec8b3106e13ace9b109b6bdbc25
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171023Reviewed-by: default avatarRob Pike <r@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8116599f