mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
core/vm: remove unnecessary benchmarks
This commit is contained in:
parent
6ab7639a1b
commit
cf0b39c0c8
1 changed files with 0 additions and 51 deletions
|
|
@ -972,54 +972,3 @@ func TestPush(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func FuzzPush(f *testing.F) {
|
|
||||||
push2 := makePush(2, 2)
|
|
||||||
f.Fuzz(func(t *testing.T, code []byte, origPC uint64) {
|
|
||||||
scope := &ScopeContext{
|
|
||||||
Memory: nil,
|
|
||||||
Stack: newstack(),
|
|
||||||
Contract: &Contract{
|
|
||||||
Code: code,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
pc := origPC
|
|
||||||
push2(&pc, nil, scope)
|
|
||||||
a := scope.Stack.pop()
|
|
||||||
pc = origPC
|
|
||||||
opPush2(&pc, nil, scope)
|
|
||||||
b := scope.Stack.pop()
|
|
||||||
if a.Cmp(&b) != 0 {
|
|
||||||
panic(fmt.Sprintf("code: %v origPC: %v, %v %v", code, origPC, a, b))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkPush(b *testing.B) {
|
|
||||||
var (
|
|
||||||
code = common.FromHex("0011223344556677889900aabbccddeeff0102030405060708090a0b0c0d0e0ff1e1d1c1b1a19181716151413121")
|
|
||||||
push2 = makePush(2, 2)
|
|
||||||
scope = &ScopeContext{
|
|
||||||
Memory: nil,
|
|
||||||
Stack: newstack(),
|
|
||||||
Contract: &Contract{
|
|
||||||
Code: code,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
pc = new(uint64)
|
|
||||||
)
|
|
||||||
|
|
||||||
b.Run("makePush", func(b *testing.B) {
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
push2(pc, nil, scope)
|
|
||||||
scope.Stack.pop()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
b.Run("push", func(b *testing.B) {
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
opPush2(pc, nil, scope)
|
|
||||||
scope.Stack.pop()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue