1. 03 Mar, 2019 3 commits
    • Daniel Martí's avatar
      os/exec: preallocate for Cmd.childFiles · 59712fd0
      Daniel Martí authored
      We're always going to add stdin, stdout, and stderr to childFiles, so
      its length will be at least three. The final length will be those three
      elements plus however many files were given via ExtraFiles.
      
      Allocate for that final length directly, saving two slice growth allocs
      in the common case where ExtraFiles is empty.
      
      name        old time/op    new time/op    delta
      ExecEcho-8     435µs ± 0%     435µs ± 0%    ~     (p=0.394 n=6+6)
      
      name        old alloc/op   new alloc/op   delta
      ExecEcho-8    6.39kB ± 0%    6.37kB ± 0%  -0.39%  (p=0.002 n=6+6)
      
      name        old allocs/op  new allocs/op  delta
      ExecEcho-8      36.0 ± 0%      34.0 ± 0%  -5.56%  (p=0.002 n=6+6)
      
      Change-Id: Ib702c0da1e43f0a55ed937af6d45fca6a170e8f3
      Reviewed-on: https://go-review.googlesource.com/c/164898
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      59712fd0
    • Leon Klingele's avatar
      cmd/internal/obj/mips: use r instead of p.Reg in call to OP_IRR · ec01d8f7
      Leon Klingele authored
      Change-Id: Id77764ed2d693e632e2a7b4e4638c17e0caf2276
      GitHub-Last-Rev: 9ebe28252086ddcd530905eb9cf50b4a66413291
      GitHub-Pull-Request: golang/go#30003
      Reviewed-on: https://go-review.googlesource.com/c/160427Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ec01d8f7
    • Daniel Martí's avatar
      encoding/base64: lift nil check out of encode loop · fc42cf8b
      Daniel Martí authored
      Most of the encoding time is spent in the first Encode loop, since the
      rest of the function only deals with the few remaining bytes. Any
      unnecessary work done in that loop body matters tremendously.
      
      One such unnecessary bottleneck was the use of the enc.encode table.
      Since enc is a pointer receiver, and the field is first used within the
      loop, the encoder must perform a nil check at every iteration.
      
      Add a dummy use of the field before the start of the loop, to move the
      nil check there. After that line, the compiler now knows that enc can't
      be nil, and thus the hot loop is free of nil checks.
      
      name              old time/op    new time/op    delta
      EncodeToString-4    14.7µs ± 0%    13.7µs ± 1%  -6.53%  (p=0.000 n=10+10)
      
      name              old speed      new speed      delta
      EncodeToString-4   559MB/s ± 0%   598MB/s ± 1%  +6.99%  (p=0.000 n=10+10)
      
      Updates #20206.
      
      Change-Id: Icbb523a7bd9e470a8be0a448d1d78ade97ed4ff6
      Reviewed-on: https://go-review.googlesource.com/c/151158
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      fc42cf8b
  2. 02 Mar, 2019 22 commits
  3. 01 Mar, 2019 15 commits