diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-17 23:10:32 +0100 |
|---|---|---|
| committer | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-02-17 23:10:32 +0100 |
| commit | 798c6feac22d94019e1247ec57c17fe3bc29fdb6 (patch) | |
| tree | 515806293fa72e974c20f15bbd289ec90ecf5d75 | |
| parent | d75abe3505126ecb579cc68cbe340abfb101c3bb (diff) | |
| download | sylt-798c6feac22d94019e1247ec57c17fe3bc29fdb6.tar.gz | |
add fibonacci benchmark
| -rw-r--r-- | progs/bench/fib.sy | 10 |
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 |
