aboutsummaryrefslogtreecommitdiffstats
path: root/src/VMTestsFiller/loop-exp.sol
diff options
context:
space:
mode:
authorDimitry <dimitry@ethdev.com>2016-12-05 19:12:05 +0800
committerDimitry <dimitry@ethdev.com>2016-12-05 19:12:05 +0800
commite2a69159c863d810a368eda8aa417290d95dc52e (patch)
tree75da52555f6c077fdf580b24bcd8268c968da62e /src/VMTestsFiller/loop-exp.sol
parent35cfcf16190fc3e56ee11ead23452c633e2fca28 (diff)
downloaddexon-tests-e2a69159c863d810a368eda8aa417290d95dc52e.tar.gz
dexon-tests-e2a69159c863d810a368eda8aa417290d95dc52e.tar.zst
dexon-tests-e2a69159c863d810a368eda8aa417290d95dc52e.zip
Test Fillers (Sources for the tests)
Diffstat (limited to 'src/VMTestsFiller/loop-exp.sol')
-rw-r--r--src/VMTestsFiller/loop-exp.sol45
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;
+ }
+}