Commits

Bryan O'Sullivan committed 5fe582e

Dump out rate information for benchmarking.

  • Participants
  • Parent commits 0086277

Comments (0)

Files changed (2)

File benchmarks/AesonEncode.hs

             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"

File benchmarks/AesonParse.hs

             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"