mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
core/types: add benchmark
This commit is contained in:
parent
e5f4b274b3
commit
58fb7bf89a
1 changed files with 19 additions and 0 deletions
|
|
@ -576,3 +576,22 @@ func TestYParityJSONUnmarshalling(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkHash(b *testing.B) {
|
||||
signer := NewLondonSigner(big.NewInt(1))
|
||||
to := common.Address{}
|
||||
tx := NewTx(&DynamicFeeTx{
|
||||
ChainID: big.NewInt(123),
|
||||
Nonce: 1,
|
||||
Gas: 1000000,
|
||||
To: &to,
|
||||
Value: big.NewInt(1),
|
||||
GasTipCap: big.NewInt(500),
|
||||
GasFeeCap: big.NewInt(500),
|
||||
})
|
||||
for i := 0; i < b.N; i++ {
|
||||
signer.Hash(tx)
|
||||
}
|
||||
}
|
||||
|
||||
// BenchmarkHash-8 541969 2320 ns/op 240 B/op 6 allocs/op
|
||||
|
|
|
|||
Loading…
Reference in a new issue