mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
core/vm/runtime: benchtest with pushing/popping looping code
This commit is contained in:
parent
f8f5609b8e
commit
287aa9c604
1 changed files with 12 additions and 0 deletions
|
|
@ -514,6 +514,17 @@ func BenchmarkSimpleLoop(b *testing.B) {
|
||||||
byte(vm.JUMP),
|
byte(vm.JUMP),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loopingCode2 := []byte{
|
||||||
|
byte(vm.JUMPDEST), // [ count ]
|
||||||
|
// push args for the call
|
||||||
|
byte(vm.PUSH4), 1, 2, 3, 4,
|
||||||
|
byte(vm.PUSH5), 1, 2, 3, 4, 5,
|
||||||
|
|
||||||
|
byte(vm.POP), byte(vm.POP),
|
||||||
|
byte(vm.PUSH6), 0, 0, 0, 0, 0, 0, // jumpdestination
|
||||||
|
byte(vm.JUMP),
|
||||||
|
}
|
||||||
|
|
||||||
callRevertingContractWithInput := []byte{
|
callRevertingContractWithInput := []byte{
|
||||||
byte(vm.JUMPDEST), //
|
byte(vm.JUMPDEST), //
|
||||||
// push args for the call
|
// push args for the call
|
||||||
|
|
@ -540,6 +551,7 @@ func BenchmarkSimpleLoop(b *testing.B) {
|
||||||
benchmarkNonModifyingCode(100000000, staticCallIdentity, "staticcall-identity-100M", "", b)
|
benchmarkNonModifyingCode(100000000, staticCallIdentity, "staticcall-identity-100M", "", b)
|
||||||
benchmarkNonModifyingCode(100000000, callIdentity, "call-identity-100M", "", b)
|
benchmarkNonModifyingCode(100000000, callIdentity, "call-identity-100M", "", b)
|
||||||
benchmarkNonModifyingCode(100000000, loopingCode, "loop-100M", "", b)
|
benchmarkNonModifyingCode(100000000, loopingCode, "loop-100M", "", b)
|
||||||
|
benchmarkNonModifyingCode(100000000, loopingCode2, "loop2-100M", "", b)
|
||||||
benchmarkNonModifyingCode(100000000, callInexistant, "call-nonexist-100M", "", b)
|
benchmarkNonModifyingCode(100000000, callInexistant, "call-nonexist-100M", "", b)
|
||||||
benchmarkNonModifyingCode(100000000, callEOA, "call-EOA-100M", "", b)
|
benchmarkNonModifyingCode(100000000, callEOA, "call-EOA-100M", "", b)
|
||||||
benchmarkNonModifyingCode(100000000, callRevertingContractWithInput, "call-reverting-100M", "", b)
|
benchmarkNonModifyingCode(100000000, callRevertingContractWithInput, "call-reverting-100M", "", b)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue