aboutsummaryrefslogtreecommitdiffstats
path: root/PerformaceTester.sol
diff options
context:
space:
mode:
authorPaweł Bylica <pawel.bylica@imapp.pl>2015-02-13 21:56:27 +0800
committerPaweł Bylica <pawel.bylica@imapp.pl>2015-02-13 21:56:27 +0800
commit14b67bc0ffd7a3ee8fc4629e8cfb93e33e095858 (patch)
tree00326daa802c98e20e95a33693fbfbd5e95fee1f /PerformaceTester.sol
parent238d7ccc014ba91488b2e33740e8479ebe969c10 (diff)
downloaddexon-solidity-14b67bc0ffd7a3ee8fc4629e8cfb93e33e095858.tar.gz
dexon-solidity-14b67bc0ffd7a3ee8fc4629e8cfb93e33e095858.tar.zst
dexon-solidity-14b67bc0ffd7a3ee8fc4629e8cfb93e33e095858.zip
Performance tests: more ackermann calls, fibonacci.
- ackermann(3, 1) - ackermann(3, 2) - fibonacci(10) - fibonacci(16) Contract code included: PerformanceTester.sol
Diffstat (limited to 'PerformaceTester.sol')
-rw-r--r--PerformaceTester.sol17
1 files changed, 17 insertions, 0 deletions
diff --git a/PerformaceTester.sol b/PerformaceTester.sol
new file mode 100644
index 00000000..3b1202ce
--- /dev/null
+++ b/PerformaceTester.sol
@@ -0,0 +1,17 @@
+contract PerformanceTester {
+ function ackermann(uint m, uint n) returns (uint) {
+ if (m == 0)
+ return n + 1;
+
+ if (n == 0)
+ return ackermann(m - 1, 1);
+
+ return ackermann(m - 1, ackermann(m, n - 1));
+ }
+
+ function fibonacci(uint n) returns (uint) {
+ if (n == 0 || n == 1)
+ return n;
+ return fibonacci(n - 1) + fibonacci(n - 2);
+ }
+} \ No newline at end of file