From: Rémy Oudompheng Date: Sat, 2 Mar 2013 20:11:05 +0000 (+0100) Subject: runtime: benchmark for appending N bytes should not append N² bytes. X-Git-Tag: go1.1rc2~718 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1f74aa21d54244ea7ee4e0cabc101eb6f0ad19cb;p=gostls13.git runtime: benchmark for appending N bytes should not append N² bytes. R=golang-dev, r CC=golang-dev https://golang.org/cl/7420051 --- diff --git a/src/pkg/runtime/append_test.go b/src/pkg/runtime/append_test.go index 6eb901699b..36390181e8 100644 --- a/src/pkg/runtime/append_test.go +++ b/src/pkg/runtime/append_test.go @@ -26,9 +26,7 @@ func benchmarkAppendBytes(b *testing.B, length int) { b.StartTimer() for i := 0; i < b.N; i++ { x = x[0:0] - for j := 0; j < N; j++ { - x = append(x, y...) - } + x = append(x, y...) } } @@ -58,9 +56,7 @@ func benchmarkAppendStr(b *testing.B, str string) { b.StartTimer() for i := 0; i < b.N; i++ { x = x[0:0] - for j := 0; j < N; j++ { - x = append(x, str...) - } + x = append(x, str...) } }