Skip to content

Instantly share code, notes, and snippets.

@fero23
Last active November 5, 2015 19:09
Show Gist options
  • Save fero23/db074ef2b8685fb3e5d1 to your computer and use it in GitHub Desktop.
Save fero23/db074ef2b8685fb3e5d1 to your computer and use it in GitHub Desktop.
Haskell benchmark test
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