Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
tests(evm): add benchmark tests setup for params (#1623)
Browse files Browse the repository at this point in the history
* tests: add benchmark tests setup

* fix: localized benchmark tests to keeper

* update benchmark

Co-authored-by: Federico Kunze Küllmer <[email protected]>
  • Loading branch information
Vvaradinov and fedekunze authored Jan 23, 2023
1 parent b990a83 commit 9305788
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions x/evm/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"math"
"math/big"
"os"
"testing"
"time"

Expand Down Expand Up @@ -77,6 +78,9 @@ type KeeperTestSuite struct {
var s *KeeperTestSuite

func TestKeeperTestSuite(t *testing.T) {
if os.Getenv("benchmark") != "" {
t.Skip("Skipping Gingko Test")
}
s = new(KeeperTestSuite)
s.enableFeemarket = false
s.enableLondonHF = true
Expand Down
30 changes: 30 additions & 0 deletions x/evm/keeper/params_benchmark_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package keeper_test

import (
"testing"

"github.com/evmos/ethermint/x/evm/types"
)

func BenchmarkSetParams(b *testing.B) {
suite := KeeperTestSuite{}
suite.SetupTestWithT(b)
params := types.DefaultParams()

b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = suite.app.EvmKeeper.SetParams(suite.ctx, params)
}
}

func BenchmarkGetParams(b *testing.B) {
suite := KeeperTestSuite{}
suite.SetupTestWithT(b)

b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = suite.app.EvmKeeper.GetParams(suite.ctx)
}
}

0 comments on commit 9305788

Please sign in to comment.