Skip to content

Commit

Permalink
use cronos mainnet genesis for benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Oct 25, 2023
1 parent 1ad9a8f commit 63b604c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 551 deletions.
5 changes: 3 additions & 2 deletions types/chain_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,14 @@ func TestParseChainIDFromGenesis(t *testing.T) {
}

func BenchmarkParseChainID(b *testing.B) {
expChainID := "cronosmainnet_25-1"
b.ReportAllocs()
b.Run("new", func(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
chainId, err := ParseChainIDFromGenesis(strings.NewReader(BenchmarkGenesis))
require.NoError(b, err)
require.Equal(b, "test_777-1", chainId)
require.Equal(b, expChainID, chainId)
}
})

Expand All @@ -122,7 +123,7 @@ func BenchmarkParseChainID(b *testing.B) {
for i := 0; i < b.N; i++ {
doc, err := genutiltypes.AppGenesisFromReader(strings.NewReader(BenchmarkGenesis))
require.NoError(b, err)
require.Equal(b, "test_777-1", doc.ChainID)
require.Equal(b, expChainID, doc.ChainID)
}
})
}
Loading

0 comments on commit 63b604c

Please sign in to comment.