mirror of
https://github.com/minio/minio.git
synced 2024-12-26 07:05:55 -05:00
Avoid allocating 1gig memory, avoid such mistakes
This commit is contained in:
parent
91c48e8d73
commit
2f04a1299e
@ -131,7 +131,7 @@ func (s *MySuite) TestLengthMismatchInWrite(c *C) {
|
|||||||
c.Assert(err, Not(IsNil))
|
c.Assert(err, Not(IsNil))
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf = make([]byte, 1024*1024*1024)
|
var buf = make([]byte, 1024*1024*8)
|
||||||
|
|
||||||
func benchmarkSize(b *testing.B, size int) {
|
func benchmarkSize(b *testing.B, size int) {
|
||||||
b.SetBytes(int64(size))
|
b.SetBytes(int64(size))
|
||||||
@ -141,18 +141,18 @@ func benchmarkSize(b *testing.B, size int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkDonut64M(b *testing.B) {
|
func BenchmarkDonut1M(b *testing.B) {
|
||||||
benchmarkSize(b, 1024*1024*64)
|
benchmarkSize(b, 1024*1024)
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkDonut128M(b *testing.B) {
|
func BenchmarkDonut2M(b *testing.B) {
|
||||||
benchmarkSize(b, 1024*1024*128)
|
benchmarkSize(b, 1024*1024*2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkDonut256M(b *testing.B) {
|
func BenchmarkDonut4M(b *testing.B) {
|
||||||
benchmarkSize(b, 1024*1024*256)
|
benchmarkSize(b, 1024*1024*4)
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkDonut512M(b *testing.B) {
|
func BenchmarkDonut8M(b *testing.B) {
|
||||||
benchmarkSize(b, 1024*1024*512)
|
benchmarkSize(b, 1024*1024*8)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user