core/vm: reuse Keccak-256 hashes across opcode executions (#17863)

This commit is contained in:
Péter Szilágyi
2018-10-08 14:14:29 +03:00
committed by Felix Lange
parent c5cb214f68
commit 1d3d4a4d57
3 changed files with 49 additions and 7 deletions

View File

@ -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