forked from cerc-io/plugeth
core/vm: update benchmarks for core/vm (#17308)
- Update benchmarks to use a pool of int pools. Unless benchmarks are aborted with segmentation fault. Signed-off-by: Hyung-Kyu Choi <hqueue@users.noreply.github.com>
This commit is contained in:
parent
adc2944b4c
commit
0ab54de1a5
@ -214,6 +214,7 @@ func opBenchmark(bench *testing.B, op func(pc *uint64, interpreter *EVMInterpret
|
|||||||
)
|
)
|
||||||
|
|
||||||
env.interpreter = evmInterpreter
|
env.interpreter = evmInterpreter
|
||||||
|
evmInterpreter.intPool = poolOfIntPools.get()
|
||||||
// convert args
|
// convert args
|
||||||
byteArgs := make([][]byte, len(args))
|
byteArgs := make([][]byte, len(args))
|
||||||
for i, arg := range args {
|
for i, arg := range args {
|
||||||
@ -229,6 +230,7 @@ func opBenchmark(bench *testing.B, op func(pc *uint64, interpreter *EVMInterpret
|
|||||||
op(&pc, evmInterpreter, nil, nil, stack)
|
op(&pc, evmInterpreter, nil, nil, stack)
|
||||||
stack.pop()
|
stack.pop()
|
||||||
}
|
}
|
||||||
|
poolOfIntPools.put(evmInterpreter.intPool)
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkOpAdd64(b *testing.B) {
|
func BenchmarkOpAdd64(b *testing.B) {
|
||||||
@ -474,6 +476,7 @@ func BenchmarkOpMstore(bench *testing.B) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
env.interpreter = evmInterpreter
|
env.interpreter = evmInterpreter
|
||||||
|
evmInterpreter.intPool = poolOfIntPools.get()
|
||||||
mem.Resize(64)
|
mem.Resize(64)
|
||||||
pc := uint64(0)
|
pc := uint64(0)
|
||||||
memStart := big.NewInt(0)
|
memStart := big.NewInt(0)
|
||||||
@ -484,4 +487,5 @@ func BenchmarkOpMstore(bench *testing.B) {
|
|||||||
stack.pushN(value, memStart)
|
stack.pushN(value, memStart)
|
||||||
opMstore(&pc, evmInterpreter, nil, mem, stack)
|
opMstore(&pc, evmInterpreter, nil, mem, stack)
|
||||||
}
|
}
|
||||||
|
poolOfIntPools.put(evmInterpreter.intPool)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user