From a96e761457b70b9020fab4830011bef7b93651eb Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Wed, 27 Jan 2021 23:52:08 -0800 Subject: [PATCH] all: ensure b.ReportAllocs() in all the benchmarks (#8460) With this change, we'll get details on the number of allocations performed by code. Later on when we have continuous benchmarking infrastructure, this change will prove useful to flag regressions. Fixes #8459 Co-authored-by: Alessio Treglia --- sim_bench_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sim_bench_test.go b/sim_bench_test.go index 7c22dcfe8a44..ba5c71c6f3fb 100644 --- a/sim_bench_test.go +++ b/sim_bench_test.go @@ -14,6 +14,7 @@ import ( // Profile with: // /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/simapp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out func BenchmarkFullAppSimulation(b *testing.B) { + b.ReportAllocs() config, db, dir, logger, _, err := SetupSimulation("goleveldb-app-sim", "Simulation") if err != nil { b.Fatalf("simulation setup failed: %s", err.Error()) @@ -57,6 +58,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { } func BenchmarkInvariants(b *testing.B) { + b.ReportAllocs() config, db, dir, logger, _, err := SetupSimulation("leveldb-app-invariant-bench", "Simulation") if err != nil { b.Fatalf("simulation setup failed: %s", err.Error())