Skip to content

Instantly share code, notes, and snippets.

@nicokosi
Created August 19, 2015 07:21
Show Gist options
  • Save nicokosi/ba0b5161c2736cd65525 to your computer and use it in GitHub Desktop.
Save nicokosi/ba0b5161c2736cd65525 to your computer and use it in GitHub Desktop.
import System.CPUTime
fibo :: Int -> Int
fibo n
| n <= 1 = n
| otherwise = fibo(n - 1) + fibo(n - 2)
getCPUTimeDouble :: IO Double
getCPUTimeDouble = do t <- System.CPUTime.getCPUTime; return ((fromInteger t) * 1e-12)
main = do
t1 <- getCPUTimeDouble
t2 <- getCPUTimeDouble
print (fibo(32))
print (t2 - t1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment