1
0
mirror of https://github.com/golang/go synced 2024-10-02 02:28:32 -06:00

text/tabwriter: fix BenchmarkPyramid and BenchmarkRagged

These were added in CL 106979. They were wrong.

The correct impact of CL 106979 on these benchmarks is:

name            old time/op    new time/op    delta
Pyramid/10-8      6.22µs ± 1%    5.68µs ± 0%    -8.78%  (p=0.000 n=15+13)
Pyramid/100-8      275µs ± 1%     255µs ± 1%    -7.30%  (p=0.000 n=15+13)
Pyramid/1000-8    25.6ms ± 1%    24.8ms ± 1%    -2.88%  (p=0.000 n=15+14)
Ragged/10-8       8.98µs ± 1%    6.74µs ± 0%   -24.98%  (p=0.000 n=15+14)
Ragged/100-8      85.3µs ± 0%    57.5µs ± 1%   -32.51%  (p=0.000 n=13+15)
Ragged/1000-8      847µs ± 1%     561µs ± 1%   -33.85%  (p=0.000 n=14+15)

name            old alloc/op   new alloc/op   delta
Pyramid/10-8      4.74kB ± 0%    4.88kB ± 0%    +3.04%  (p=0.000 n=15+15)
Pyramid/100-8      379kB ± 0%     411kB ± 0%    +8.50%  (p=0.000 n=15+12)
Pyramid/1000-8    35.3MB ± 0%    41.6MB ± 0%   +17.68%  (p=0.000 n=15+15)
Ragged/10-8       4.82kB ± 0%    1.82kB ± 0%   -62.13%  (p=0.000 n=15+15)
Ragged/100-8      45.4kB ± 0%     1.8kB ± 0%   -95.98%  (p=0.000 n=15+15)
Ragged/1000-8      449kB ± 0%       2kB ± 0%   -99.59%  (p=0.000 n=15+15)

name            old allocs/op  new allocs/op  delta
Pyramid/10-8        50.0 ± 0%      35.0 ± 0%   -30.00%  (p=0.000 n=15+15)
Pyramid/100-8        704 ± 0%       231 ± 0%   -67.19%  (p=0.000 n=15+15)
Pyramid/1000-8     10.0k ± 0%      2.1k ± 0%   -79.52%  (p=0.000 n=15+15)
Ragged/10-8         60.0 ± 0%      19.0 ± 0%   -68.33%  (p=0.000 n=15+15)
Ragged/100-8         511 ± 0%        19 ± 0%   -96.28%  (p=0.000 n=15+15)
Ragged/1000-8      5.01k ± 0%     0.02k ± 0%   -99.62%  (p=0.000 n=15+15)


This is an improvement over what was originally reported,
except the increase in alloc/op for the Pyramid benchmarks.

Change-Id: Ib2617c1288ce35f2c78e0172533d231b86e48bc2
Reviewed-on: https://go-review.googlesource.com/111643
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2018-05-05 20:17:49 -07:00
parent 5cf3e34f96
commit 87412a1430

View File

@ -701,6 +701,7 @@ func BenchmarkPyramid(b *testing.B) {
// Write increasing prefixes of that line.
for j := 0; j < x; j++ {
w.Write(line[:j*2])
w.Write([]byte{'\n'})
}
w.Flush()
}
@ -723,6 +724,7 @@ func BenchmarkRagged(b *testing.B) {
// Write the lines in turn h times.
for j := 0; j < h; j++ {
w.Write(lines[j%len(lines)])
w.Write([]byte{'\n'})
}
w.Flush()
}