aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--progs/bench/fib.sy10
1 files changed, 10 insertions, 0 deletions
diff --git a/progs/bench/fib.sy b/progs/bench/fib.sy
new file mode 100644
index 0000000..a6504bf
--- /dev/null
+++ b/progs/bench/fib.sy
@@ -0,0 +1,10 @@
+// The worst implementation of fibonacci calculations
+// possible. FYI, it can be done in constant time.
+fib :: fn a:int -> int {
+ if a < 2 {
+ ret a
+ }
+ ret fib(a - 1) + fib(a - 2)
+}
+// 23 is around where things start getting slow.
+fib(28) <=> 317811