aboutsummaryrefslogtreecommitdiffstats
path: root/progs/bench
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-02-17 23:10:32 +0100
committerEdvard Thörnros <edvard.thornros@gmail.com>2021-02-17 23:10:32 +0100
commit798c6feac22d94019e1247ec57c17fe3bc29fdb6 (patch)
tree515806293fa72e974c20f15bbd289ec90ecf5d75 /progs/bench
parentd75abe3505126ecb579cc68cbe340abfb101c3bb (diff)
downloadsylt-798c6feac22d94019e1247ec57c17fe3bc29fdb6.tar.gz
add fibonacci benchmark
Diffstat (limited to 'progs/bench')
-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