diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-10-08 19:14:29 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-10-08 19:14:29 +0800 |
commit | 1d3d4a4d578825b040a3cac9eb163e7f3c16ce4b (patch) | |
tree | 00ce13af5e001692be11412e2e8e372bd9c0bbc5 /core/vm/instructions_test.go | |
parent | c5cb214f689e5c34bf487daa8eb4234d6e3237a7 (diff) | |
download | dexon-1d3d4a4d578825b040a3cac9eb163e7f3c16ce4b.tar.gz dexon-1d3d4a4d578825b040a3cac9eb163e7f3c16ce4b.tar.zst dexon-1d3d4a4d578825b040a3cac9eb163e7f3c16ce4b.zip |
core/vm: reuse Keccak-256 hashes across opcode executions (#17863)
Diffstat (limited to 'core/vm/instructions_test.go')
-rw-r--r-- | core/vm/instructions_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/vm/instructions_test.go b/core/vm/instructions_test.go index 73c5befaa..8a48d765d 100644 --- a/core/vm/instructions_test.go +++ b/core/vm/instructions_test.go @@ -492,6 +492,27 @@ func BenchmarkOpMstore(bench *testing.B) { poolOfIntPools.put(evmInterpreter.intPool) } +func BenchmarkOpSHA3(bench *testing.B) { + var ( + env = NewEVM(Context{}, nil, params.TestChainConfig, Config{}) + stack = newstack() + mem = NewMemory() + evmInterpreter = NewEVMInterpreter(env, env.vmConfig) + ) + env.interpreter = evmInterpreter + evmInterpreter.intPool = poolOfIntPools.get() + mem.Resize(32) + pc := uint64(0) + start := big.NewInt(0) + + bench.ResetTimer() + for i := 0; i < bench.N; i++ { + stack.pushN(big.NewInt(32), start) + opSha3(&pc, evmInterpreter, nil, mem, stack) + } + poolOfIntPools.put(evmInterpreter.intPool) +} + func TestCreate2Addreses(t *testing.T) { type testcase struct { origin string |