]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: benchmark for appending N bytes should not append N² bytes.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Sat, 2 Mar 2013 20:11:05 +0000 (21:11 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Sat, 2 Mar 2013 20:11:05 +0000 (21:11 +0100)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7420051

src/pkg/runtime/append_test.go

index 6eb901699b8ed8d302a0830fb8ce871ae2710c4b..36390181e87fa5658c442e10c361d15d4bc97589 100644 (file)
@@ -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...)
        }
 }