From 2f04a1299eb8eda8db3bc3570c65b34ee5314c09 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 1 Mar 2015 00:43:12 -0800 Subject: [PATCH] Avoid allocating 1gig memory, avoid such mistakes --- pkg/storage/donut/frame/frame_v1/donut_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/storage/donut/frame/frame_v1/donut_test.go b/pkg/storage/donut/frame/frame_v1/donut_test.go index a6fe79245..f2264e433 100644 --- a/pkg/storage/donut/frame/frame_v1/donut_test.go +++ b/pkg/storage/donut/frame/frame_v1/donut_test.go @@ -131,7 +131,7 @@ func (s *MySuite) TestLengthMismatchInWrite(c *C) { 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) { b.SetBytes(int64(size)) @@ -141,18 +141,18 @@ func benchmarkSize(b *testing.B, size int) { } } -func BenchmarkDonut64M(b *testing.B) { - benchmarkSize(b, 1024*1024*64) +func BenchmarkDonut1M(b *testing.B) { + benchmarkSize(b, 1024*1024) } -func BenchmarkDonut128M(b *testing.B) { - benchmarkSize(b, 1024*1024*128) +func BenchmarkDonut2M(b *testing.B) { + benchmarkSize(b, 1024*1024*2) } -func BenchmarkDonut256M(b *testing.B) { - benchmarkSize(b, 1024*1024*256) +func BenchmarkDonut4M(b *testing.B) { + benchmarkSize(b, 1024*1024*4) } -func BenchmarkDonut512M(b *testing.B) { - benchmarkSize(b, 1024*1024*512) +func BenchmarkDonut8M(b *testing.B) { + benchmarkSize(b, 1024*1024*8) }