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 <alessio@tendermint.com>
This commit is contained in:
co-authored by
Alessio Treglia
parent
580e9681a5
commit
784a9a69a1
@@ -89,6 +89,7 @@ func TestBlockProvision(t *testing.T) {
|
||||
// using sdk.Dec operations: (current implementation)
|
||||
// BenchmarkBlockProvision-4 3000000 429 ns/op
|
||||
func BenchmarkBlockProvision(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
minter := InitialMinter(sdk.NewDecWithPrec(1, 1))
|
||||
params := DefaultParams()
|
||||
|
||||
@@ -105,6 +106,7 @@ func BenchmarkBlockProvision(b *testing.B) {
|
||||
// Next inflation benchmarking
|
||||
// BenchmarkNextInflation-4 1000000 1828 ns/op
|
||||
func BenchmarkNextInflation(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
minter := InitialMinter(sdk.NewDecWithPrec(1, 1))
|
||||
params := DefaultParams()
|
||||
bondedRatio := sdk.NewDecWithPrec(1, 1)
|
||||
@@ -119,6 +121,7 @@ func BenchmarkNextInflation(b *testing.B) {
|
||||
// Next annual provisions benchmarking
|
||||
// BenchmarkNextAnnualProvisions-4 5000000 251 ns/op
|
||||
func BenchmarkNextAnnualProvisions(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
minter := InitialMinter(sdk.NewDecWithPrec(1, 1))
|
||||
params := DefaultParams()
|
||||
totalSupply := sdk.NewInt(100000000000000)
|
||||
|
||||
Reference in New Issue
Block a user