]> Cypherpunks repositories - gostls13.git/commit
os/exec: provide map size hint in dedupEnvCase
authorJosh Bleecher Snyder <josharian@gmail.com>
Sat, 2 Mar 2019 19:14:33 +0000 (11:14 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sat, 2 Mar 2019 20:11:47 +0000 (20:11 +0000)
commitbeadf433c37498dafc6748cc510eeab2636b5be3
tree253d503e500e66fae542f65e1dd91797f71fd110
parent37b84e2782e5c19c3053316853a6fba923b0f06b
os/exec: provide map size hint in dedupEnvCase

The common case is that most env vars are distinct;
optimize for that.

name        old time/op    new time/op    delta
ExecEcho-8    2.16ms ± 3%    2.14ms ± 1%     ~     (p=0.315 n=10+10)

name        old alloc/op   new alloc/op   delta
ExecEcho-8    7.87kB ± 0%    6.35kB ± 0%  -19.31%  (p=0.000 n=9+10)

name        old allocs/op  new allocs/op  delta
ExecEcho-8      72.0 ± 0%      69.0 ± 0%   -4.17%  (p=0.000 n=10+10)

Change-Id: I42bb696c6862f2ea12c5cbd2f24c64336a7a759a
Reviewed-on: https://go-review.googlesource.com/c/164960
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/os/exec/exec.go