Last active
November 5, 2015 19:09
-
-
Save fero23/db074ef2b8685fb3e5d1 to your computer and use it in GitHub Desktop.
Haskell benchmark test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.CPUTime | |
wait :: a -> IO a | |
wait x = seq x (return x) | |
main :: IO () | |
main = do | |
start <- getCPUTime | |
l <- wait . last $ map abs [1..1000000000] | |
end <- getCPUTime | |
putStrLn $ "Last " ++ show l ++ ", time: " ++ show ((fromIntegral (end - start)) / (10^12)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment