tests: add message call benchmark (#717)

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
yihuang
2021-11-08 13:04:49 +00:00
committed by GitHub
co-authored by Federico Kunze Küllmer
parent e04422b6ff
commit 7c7f3f02bb
6 changed files with 150 additions and 0 deletions
@@ -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;
}
}