From a92cba56199a4b80565e928c4a2354699cc55b67 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Fri, 6 Dec 2019 10:33:57 +0100 Subject: [PATCH] tests: fix tests to use new statedb constructor --- core/state/state_object_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/state/state_object_test.go b/core/state/state_object_test.go index 42fd778025..6cce7fe620 100644 --- a/core/state/state_object_test.go +++ b/core/state/state_object_test.go @@ -18,6 +18,8 @@ package state import ( "bytes" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/rlp" "testing" "github.com/ethereum/go-ethereum/common" @@ -44,3 +46,19 @@ func BenchmarkCutCustomTrim(b *testing.B) { common.TrimLeftZeroes(value[:]) } } + +// BenchmarkHashKey-6 1221526 975 ns/op +func BenchmarkHashKey(b *testing.B) { + key := common.HexToHash("0x01") + for i := 0; i < b.N; i++ { + crypto.Keccak256Hash(key[:]) + } +} + +//BenchmarkEncodeValue-6 4843382 219 ns/op +func BenchmarkEncodeValue(b *testing.B) { + value := common.HexToHash("0x01") + for i := 0; i < b.N; i++ { + rlp.EncodeToBytes(common.TrimLeftZeroes(value[:])) + } +}