Permalink
Browse files

Dump out rate information for benchmarking.

  • Loading branch information...
bos committed Mar 22, 2011
1 parent 53cc010 commit cac4b8fd8a5c314f9525bef50d4ea6438e32c35d
Showing with 8 additions and 4 deletions.
  1. +4 −2 benchmarks/AesonEncode.hs
  2. +4 −2 benchmarks/AesonParse.hs
@@ -38,5 +38,7 @@ main = do
Done _ r -> rnf (encode r) `seq` loop (n+1) r
_ -> error $ "failed to read " ++ show arg
loop 0 r
- end <- getCurrentTime
- putStrLn $ " " ++ show (diffUTCTime end start)
+ delta <- flip diffUTCTime start `fmap` getCurrentTime
+ let rate = fromIntegral count / (fromRational . toRational) delta :: Double
+ putStrLn $ " " ++ show delta
+ putStrLn $ " " ++ show (round rate) ++ " per second"
View
@@ -27,5 +27,7 @@ main = do
Done _ r -> loop (good+1) bad
_ -> loop good (bad+1)
(good, _) <- loop 0 0
- end <- getCurrentTime
- putStrLn $ " " ++ show good ++ " good, " ++ show (diffUTCTime end start)
+ delta <- flip diffUTCTime start `fmap` getCurrentTime
+ putStrLn $ " " ++ show good ++ " good, " ++ show delta
+ let rate = fromIntegral count / (fromRational . toRational) delta :: Double
+ putStrLn $ " " ++ show (round rate) ++ " per second"

0 comments on commit cac4b8f

Please sign in to comment.