mirror of
https://github.com/valyala/bytebufferpool.git
synced 2026-06-14 13:26:35 +03:00
Initial implementation
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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()
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user