1. 02 Dec, 2017 1 commit
    • Ian Lance Taylor's avatar
      os: calling Fd disables the SetDeadline methods · 41534957
      Ian Lance Taylor authored
      The full truth seems too complicated to write in this method's doc, so
      I'm going with a simple half truth.
      
      The full truth is that Fd returns the descriptor in blocking mode,
      because that is historically how it worked, and existing programs
      would be surprised if the descriptor is suddenly non-blocking. On Unix
      systems whether a file is non-blocking or not is a property of the
      underlying file description, not of a particular file descriptor, so
      changing the returned descriptor to blocking mode also changes the
      existing File to blocking mode. Blocking mode works fine, althoug I/O
      operations now take up a thread. SetDeadline and friends rely on the
      runtime poller, and the runtime poller only works if the descriptor is
      non-blocking. So it's correct that calling Fd disables SetDeadline.
      The other half of the truth is that if the program is willing to work
      with a non-blocking descriptor, it could call
      syscall.SetNonblock(descriptor, true) to change the descriptor, and
      the original File, to non-blocking mode. At that point SetDeadline
      would start working again. I tried to write that in a way that is
      short and comprehensible but failed. Since deadlines mostly work on
      pipes, and there isn't much reason to call Fd on a pipe, and few
      people use SetDeadline, I decided to punt.
      
      Fixes #22934
      
      Change-Id: I2e49e036f0bcf71f5365193831696f9e4120527c
      Reviewed-on: https://go-review.googlesource.com/81636Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      41534957
  2. 01 Dec, 2017 34 commits
  3. 30 Nov, 2017 5 commits
    • Tobias Klauser's avatar
      os: remove redundant GOOS checks in chown tests · 45c57e59
      Tobias Klauser authored
      The build tags already prevent the tests from being run on windows or
      plan9, so there is no need to check GOOS again.
      
      Change-Id: I74d3c3b7756d9c50f6e5fd4c3e8b0db618fdebbb
      Reviewed-on: https://go-review.googlesource.com/81295
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      45c57e59
    • Ian Lance Taylor's avatar
      runtime: don't block signals that will kill the program · eb97160f
      Ian Lance Taylor authored
      Otherwise we may delay the delivery of these signals for an arbitrary
      length of time. We are already careful to not block signals that the
      program has asked to see.
      
      Also make sure that we don't miss a signal delivery if a thread
      decides to stop for a while while executing the signal handler.
      
      Also clean up the TestAtomicStop output a little bit.
      
      Fixes #21433
      
      Change-Id: Ic0c1a4eaf7eba80d1abc1e9537570bf4687c2434
      Reviewed-on: https://go-review.googlesource.com/79581
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      eb97160f
    • Hiroshi Ioka's avatar
      debug/gosym: update docs for changes in Go 1.3 · b23096b5
      Hiroshi Ioka authored
      Change-Id: I850d961e0444f8d34284e994aee183afba35eaa7
      Reviewed-on: https://go-review.googlesource.com/79597Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      b23096b5
    • Ilya Tocar's avatar
      crypto/elliptic: reduce allocations on amd64 · 73f284e2
      Ilya Tocar authored
      This is inspired by
      https://blog.cloudflare.com/go-dont-collect-my-garbage/
      This CL adds allocation tracking and parallelizes p256-related benchmarks.
      Amount of allocations can be significantly reduced by marking amd64 asm
      functions as noescape. This exposes a bug in p256MovCond:
      PANDN with memory argument will fault if memory is not aligned, so they
      are replaced with MOVDQU (which is ok with unaligned memory) and
      register version of PANDN.
      
      Results on 88-thread machine (2x 22 cores) below:
      crypto/elliptic:
      name               old time/op    new time/op    delta
      BaseMultP256-88      1.50µs ±11%    1.19µs ± 5%  -20.20%  (p=0.000 n=10+10)
      ScalarMultP256-88    5.47µs ± 5%    3.63µs ±10%  -33.66%  (p=0.000 n=9+10)
      
      name               old alloc/op   new alloc/op   delta
      BaseMultP256-88        800B ± 0%      288B ± 0%  -64.00%  (p=0.000 n=10+10)
      ScalarMultP256-88    2.59kB ± 0%    0.26kB ± 0%  -90.12%  (p=0.000 n=10+10)
      
      name               old allocs/op  new allocs/op  delta
      BaseMultP256-88        13.0 ± 0%       6.0 ± 0%  -53.85%  (p=0.000 n=10+10)
      ScalarMultP256-88      16.0 ± 0%       5.0 ± 0%  -68.75%  (p=0.000 n=10+10)
      
      crypto/ecdsa:
      name              old time/op    new time/op    delta
      SignP256-88         8.63µs ±37%    7.55µs ±38%     ~     (p=0.393 n=10+10)
      VerifyP256-88       13.9µs ± 8%     7.0µs ± 7%  -49.29%  (p=0.000 n=10+9)
      KeyGeneration-88    2.77µs ±11%    2.34µs ±11%  -15.57%  (p=0.000 n=10+10)
      
      name              old alloc/op   new alloc/op   delta
      SignP256-88         4.14kB ± 1%    2.98kB ± 2%  -27.94%  (p=0.000 n=10+10)
      VerifyP256-88       4.47kB ± 0%    0.99kB ± 0%  -77.84%  (p=0.000 n=9+10)
      KeyGeneration-88    1.21kB ± 0%    0.69kB ± 0%  -42.78%  (p=0.000 n=10+10)
      
      name              old allocs/op  new allocs/op  delta
      SignP256-88           47.0 ± 0%      34.0 ± 0%  -27.66%  (p=0.000 n=10+10)
      VerifyP256-88         38.0 ± 0%      17.0 ± 0%  -55.26%  (p=0.000 n=10+10)
      KeyGeneration-88      20.0 ± 0%      13.0 ± 0%  -35.00%  (p=0.000 n=10+10)
      
      On machine with only 4 cores, results are much less impressive:
      around 2% performance gain.
      
      Change-Id: I8a2f8168f83d27ad9ace1b4b1a1e11cb83edf717
      Reviewed-on: https://go-review.googlesource.com/80757
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      73f284e2
    • Ilya Tocar's avatar
      math: remove asm version of Dim · 19928933
      Ilya Tocar authored
      Dim performance has regressed by 14% vs 1.9 on amd64.
      Current pure go version of Dim is faster and,
      what is even more important for performance, is inlinable, so
      instead of tweaking asm implementation, just remove it.
      I had to update BenchmarkDim, because it was simply reloading
      constant(answer) in a loop.
      Perf data below:
      
      name   old time/op  new time/op  delta
      Dim-6  6.79ns ± 0%  1.60ns ± 1%  -76.39%  (p=0.000 n=7+10)
      
      If I modify benchmark to be the same as in this CL results are even better:
      
      name   old time/op  new time/op  delta
      Dim-6  10.2ns ± 0%   1.6ns ± 1%  -84.27%  (p=0.000 n=8+10)
      
      Updates #21913
      
      Change-Id: I00e23c8affc293531e1d9f0e0e49f3a525634f53
      Reviewed-on: https://go-review.googlesource.com/80695
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      19928933