Skip to content

Commit

Permalink
all: ensure b.ReportAllocs() in all the benchmarks (cosmos#8460)
Browse files Browse the repository at this point in the history
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 cosmos#8459

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
  • Loading branch information
odeke-em and Alessio Treglia committed Jan 28, 2021
1 parent 525018b commit a96e761
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sim_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit a96e761

Please sign in to comment.