Skip to content

Commit cf2c2ea

Browse files
joshariangriesemer
authored andcommitted
text/tabwriter: fix BenchmarkPyramid and BenchmarkRagged again
These were added in CL 106979. I got them wrong. They were fixed in CL 111643. They were still wrong. Hopefully this change will be the last fix. With this fix, CL 106979 is allocation-neutral for BenchmarkRagged. The performance results for BenchmarkPyramid reported in CL 111643 stand. Change-Id: Id6a522e6602e5df31f504adf5a3bec9969c18649 Reviewed-on: https://go-review.googlesource.com/116015 Run-TryBot: Josh Bleecher Snyder <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]>
1 parent ef9217e commit cf2c2ea

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/text/tabwriter/tabwriter_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,6 @@ func BenchmarkPyramid(b *testing.B) {
693693
for _, x := range [...]int{10, 100, 1000} {
694694
// Build a line with x cells.
695695
line := bytes.Repeat([]byte("a\t"), x)
696-
line = append(line, '\n')
697696
b.Run(fmt.Sprintf("%d", x), func(b *testing.B) {
698697
b.ReportAllocs()
699698
for i := 0; i < b.N; i++ {
@@ -712,9 +711,8 @@ func BenchmarkPyramid(b *testing.B) {
712711
func BenchmarkRagged(b *testing.B) {
713712
var lines [8][]byte
714713
for i, w := range [8]int{6, 2, 9, 5, 5, 7, 3, 8} {
715-
// Build a line with x cells.
714+
// Build a line with w cells.
716715
lines[i] = bytes.Repeat([]byte("a\t"), w)
717-
lines[i] = append(lines[i], '\n')
718716
}
719717
for _, h := range [...]int{10, 100, 1000} {
720718
b.Run(fmt.Sprintf("%d", h), func(b *testing.B) {

0 commit comments

Comments
 (0)