Commit 1f74aa21 authored by Rémy Oudompheng's avatar Rémy Oudompheng

runtime: benchmark for appending N bytes should not append N² bytes.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7420051
parent 5aacf436
......@@ -26,10 +26,8 @@ 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...)
}
}
}
func BenchmarkAppend1Byte(b *testing.B) {
......@@ -58,10 +56,8 @@ 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...)
}
}
}
func BenchmarkAppendStr1Byte(b *testing.B) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment