forked from cerc-io/laconicd-deprecated
tests: add message call benchmark (#717)
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze Küllmer
parent
e04422b6ff
commit
7c7f3f02bb
@@ -0,0 +1,25 @@
|
||||
pragma solidity 0.5.17;
|
||||
|
||||
contract Inner {
|
||||
event TestEvent(uint256);
|
||||
function test() public returns (uint256) {
|
||||
emit TestEvent(42);
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
contract TestMessageCall {
|
||||
Inner _inner;
|
||||
constructor() public {
|
||||
_inner = new Inner();
|
||||
}
|
||||
|
||||
// benchmarks
|
||||
function benchmarkMessageCall(uint iterations) public returns (uint256) {
|
||||
uint256 n = 0;
|
||||
for (uint i=0; i < iterations; i++) {
|
||||
n += _inner.test();
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user