From 87412a143051d63f4ce68900f4668b2a3fb5c4f2 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Sat, 5 May 2018 20:17:49 -0700 Subject: [PATCH] text/tabwriter: fix BenchmarkPyramid and BenchmarkRagged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/text/tabwriter/tabwriter_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/text/tabwriter/tabwriter_test.go b/src/text/tabwriter/tabwriter_test.go index ebcad5e34f..2dddd5233c 100644 --- a/src/text/tabwriter/tabwriter_test.go +++ b/src/text/tabwriter/tabwriter_test.go @@ -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() }