acme-dns/vendor/github.com/valyala/bytebufferpool/bytebuffer_timing_test.go
2018-01-22 11:19:33 +02:00

33 lines
512 B
Go

package bytebufferpool
import (
"bytes"
"testing"
)
func BenchmarkByteBufferWrite(b *testing.B) {
s := []byte("foobarbaz")
b.RunParallel(func(pb *testing.PB) {
var buf ByteBuffer
for pb.Next() {
for i := 0; i < 100; i++ {
buf.Write(s)
}
buf.Reset()
}
})
}
func BenchmarkBytesBufferWrite(b *testing.B) {
s := []byte("foobarbaz")
b.RunParallel(func(pb *testing.PB) {
var buf bytes.Buffer
for pb.Next() {
for i := 0; i < 100; i++ {
buf.Write(s)
}
buf.Reset()
}
})
}