Skip to content

Commit 0ab54de

Browse files
hqueuekaralabe
authored andcommitted
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>
1 parent adc2944 commit 0ab54de

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎core/vm/instructions_test.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ func opBenchmark(bench *testing.B, op func(pc *uint64, interpreter *EVMInterpret
214214
)
215215

216216
env.interpreter = evmInterpreter
217+
evmInterpreter.intPool = poolOfIntPools.get()
217218
// convert args
218219
byteArgs := make([][]byte, len(args))
219220
for i, arg := range args {
@@ -229,6 +230,7 @@ func opBenchmark(bench *testing.B, op func(pc *uint64, interpreter *EVMInterpret
229230
op(&pc, evmInterpreter, nil, nil, stack)
230231
stack.pop()
231232
}
233+
poolOfIntPools.put(evmInterpreter.intPool)
232234
}
233235

234236
func BenchmarkOpAdd64(b *testing.B) {
@@ -474,6 +476,7 @@ func BenchmarkOpMstore(bench *testing.B) {
474476
)
475477

476478
env.interpreter = evmInterpreter
479+
evmInterpreter.intPool = poolOfIntPools.get()
477480
mem.Resize(64)
478481
pc := uint64(0)
479482
memStart := big.NewInt(0)
@@ -484,4 +487,5 @@ func BenchmarkOpMstore(bench *testing.B) {
484487
stack.pushN(value, memStart)
485488
opMstore(&pc, evmInterpreter, nil, mem, stack)
486489
}
490+
poolOfIntPools.put(evmInterpreter.intPool)
487491
}

0 commit comments

Comments
 (0)