diff options
author | Dimitry <dimitry@ethdev.com> | 2016-12-05 19:12:05 +0800 |
---|---|---|
committer | Dimitry <dimitry@ethdev.com> | 2016-12-05 19:12:05 +0800 |
commit | e2a69159c863d810a368eda8aa417290d95dc52e (patch) | |
tree | 75da52555f6c077fdf580b24bcd8268c968da62e /src/VMTestsFiller/loop-exp.sol | |
parent | 35cfcf16190fc3e56ee11ead23452c633e2fca28 (diff) | |
download | tangerine-tests-e2a69159c863d810a368eda8aa417290d95dc52e.tar tangerine-tests-e2a69159c863d810a368eda8aa417290d95dc52e.tar.gz tangerine-tests-e2a69159c863d810a368eda8aa417290d95dc52e.tar.bz2 tangerine-tests-e2a69159c863d810a368eda8aa417290d95dc52e.tar.lz tangerine-tests-e2a69159c863d810a368eda8aa417290d95dc52e.tar.xz tangerine-tests-e2a69159c863d810a368eda8aa417290d95dc52e.tar.zst tangerine-tests-e2a69159c863d810a368eda8aa417290d95dc52e.zip |
Test Fillers (Sources for the tests)
Diffstat (limited to 'src/VMTestsFiller/loop-exp.sol')
-rw-r--r-- | src/VMTestsFiller/loop-exp.sol | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/VMTestsFiller/loop-exp.sol b/src/VMTestsFiller/loop-exp.sol new file mode 100644 index 000000000..e42ddecf1 --- /dev/null +++ b/src/VMTestsFiller/loop-exp.sol @@ -0,0 +1,45 @@ +pragma solidity ^0.4; + +contract ExpPerformanceTester { + + function testExp(int exponent, int seed, uint n) external returns (int) { + int e = seed; + for (uint i = 0; i < n; i += 1) { + e = e ** exponent; + } + return e; + } + + function testExpUnroll16(int exponent, int seed, uint n) external returns (int) { + int e = seed; + for (uint i = 0; i < n; i += 16) { + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + e = e ** exponent; + } + return e; + } + + function testNop(int exponent, int seed, uint n) external returns (int) { + for (uint i = 0; i < n; i += 1) {} + return seed; + } + + function testNopUnroll16(int exponent, int seed, uint n) external returns (int) { + for (uint i = 0; i < n; i += 16) {} + return seed; + } +} |