Add donut benchmark for 64MB, 128MB, 256MB, 512MB

Current average values

~~~
> minio/pkg/storage/donut/v1 *> go test -bench .
OK: 2 passed
PASS
BenchmarkDonut64M              5         266249634 ns/op         252.05 MB/s
BenchmarkDonut128M             3         436507394 ns/op         307.48 MB/s
BenchmarkDonut256M             2         836116359 ns/op         321.05 MB/s
BenchmarkDonut512M             1        1676738951 ns/op         320.19 MB/s
ok      github.com/minio-io/minio/pkg/storage/donut/v1  8.430s
> minio/pkg/storage/donut/v1 *>
~~~
master
Harshavardhana 10 years ago
parent 24c5ab70be
commit 6b397844b9
  1. 26
      pkg/storage/donut/v1/donut_test.go

@ -130,3 +130,29 @@ func (s *MySuite) TestLengthMismatchInWrite(c *C) {
err := Write(&testData, bytes.NewBufferString("hello, world"), 5)
c.Assert(err, Not(IsNil))
}
var buf = make([]byte, 1024*1024*1024)
func benchmarkSize(b *testing.B, size int) {
b.SetBytes(int64(size))
target := new(bytes.Buffer)
for i := 0; i < b.N; i++ {
Write(target, bytes.NewReader(buf[:size]), uint64(size))
}
}
func BenchmarkDonut64M(b *testing.B) {
benchmarkSize(b, 1024*1024*64)
}
func BenchmarkDonut128M(b *testing.B) {
benchmarkSize(b, 1024*1024*128)
}
func BenchmarkDonut256M(b *testing.B) {
benchmarkSize(b, 1024*1024*256)
}
func BenchmarkDonut512M(b *testing.B) {
benchmarkSize(b, 1024*1024*512)
}

Loading…
Cancel
Save