MCPcopy Create free account
hub / github.com/DNAProject/DNA / BenchmarkExecuteAdd

Function BenchmarkExecuteAdd

smartcontract/test/common_test.go:59–89  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

57}
58
59func BenchmarkExecuteAdd(b *testing.B) {
60 code := []byte{byte(neovm.PUSH1)}
61
62 N := 50000
63 for i := 0; i < N; i++ {
64 code = append(code, byte(neovm.PUSH1), byte(neovm.ADD))
65 }
66 code = append(code, byte(neovm.RET))
67
68 config := &smartcontract.Config{
69 Time: 10,
70 Height: 10,
71 Tx: nil,
72 }
73
74 for i := 0; i < b.N; i++ {
75 sc := smartcontract.SmartContract{
76 Config: config,
77 Gas: 1000000,
78 }
79 engine, err := sc.NewExecuteEngine(code, types.InvokeNeo)
80 if err != nil {
81 panic(err)
82 }
83 _, err = engine.Invoke()
84 if err != nil {
85 panic(err)
86 }
87 }
88
89}

Callers

nothing calls this directly

Calls 2

NewExecuteEngineMethod · 0.95
InvokeMethod · 0.65

Tested by

no test coverage detected