From eb2527e2b4677710972f48b484a3f786822decdc Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 12 Jun 2019 18:50:15 -0700 Subject: [PATCH] ci: eager GC in benchmarks --- test/integration/bench_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/integration/bench_test.go b/test/integration/bench_test.go index bc5a22ea91d..27307d4268d 100644 --- a/test/integration/bench_test.go +++ b/test/integration/bench_test.go @@ -1,6 +1,7 @@ package integrationtest import ( + "runtime" "testing" "github.com/ipfs/go-ipfs/thirdparty/unit" @@ -8,16 +9,17 @@ import ( ) func benchmarkAddCat(numBytes int64, conf testutil.LatencyConfig, b *testing.B) { - - b.StopTimer() - b.SetBytes(numBytes) data := RandomBytes(numBytes) // we don't want to measure the time it takes to generate this data - b.StartTimer() + b.SetBytes(numBytes) + b.ResetTimer() for n := 0; n < b.N; n++ { if err := DirectAddCat(data, conf); err != nil { b.Fatal(err) } + b.StopTimer() + runtime.GC() + b.StartTimer() } }