speculation/Benchmark.hs

15 lines
217 B
Haskell
Raw Normal View History

2010-06-28 09:25:18 +04:00
module Main where
2010-06-28 09:50:45 +04:00
import Criterion.Main
fib :: Int -> Int
fib 0 = 0
fib 1 = 1
fib n = fib (n - 1) + fib (n - 2)
2010-06-28 09:25:18 +04:00
main :: IO ()
2010-06-28 09:50:45 +04:00
main = defaultMain
[ bench "fib 1" $ nf fib 1
, bench "fib 2" $ nf fib 2
]