[commit: packages/time] format-widths, master, tasty: benchmark: regroup tests, add getSystemTime (da99ca7)
git at git.haskell.org
git at git.haskell.org
Mon Feb 20 21:20:08 UTC 2017
Repository : ssh://git@git.haskell.org/time
On branches: format-widths,master,tasty
Link : http://git.haskell.org/packages/time.git/commitdiff/da99ca7339f03e5b8f55e2e4a10789afa32b0632
>---------------------------------------------------------------
commit da99ca7339f03e5b8f55e2e4a10789afa32b0632
Author: Ashley Yakeley <ashley at yakeley.org>
Date: Sun Jan 15 16:24:26 2017 -0800
benchmark: regroup tests, add getSystemTime
>---------------------------------------------------------------
da99ca7339f03e5b8f55e2e4a10789afa32b0632
benchmark/Main.hs | 45 ++++++++++++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/benchmark/Main.hs b/benchmark/Main.hs
index 854144a..4807034 100644
--- a/benchmark/Main.hs
+++ b/benchmark/Main.hs
@@ -4,6 +4,7 @@ module Main where
import Criterion.Main
import Data.Time
import Data.Time.Clock.POSIX
+import Data.Time.Clock.System
import qualified "time" Data.Time as O
import qualified "time" Data.Time.Clock.POSIX as O
@@ -22,22 +23,32 @@ main = do
_otz <- O.getCurrentTimeZone
oct <- O.getCurrentTime
- defaultMain
- [ bgroup "new"
- [ bench "getCurrentTime" $ nfIO getCurrentTime
- , bench "getPOSIXTime" $ nfIO getPOSIXTime
- , bench "getTimeZone" $ nfIO $ getTimeZone ct
- , bench "getCurrentTimeZone" $ nfIO getCurrentTimeZone
- , bench "getZonedTime" $ nfIO getZonedTime
- , bench "formatTime" $ nf (formatTime defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") ct
- ]
- ,
- bgroup "old"
- [ bench "getCurrentTime" $ nfIO O.getCurrentTime
- , bench "getPOSIXTime" $ nfIO O.getPOSIXTime
- , bench "getTimeZone" $ nfIO $ O.getTimeZone oct
- , bench "getCurrentTimeZone" $ nfIO O.getCurrentTimeZone
- , bench "getZonedTime" $ nfIO O.getZonedTime
- , bench "formatTime" $ nf (O.formatTime O.defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") oct
+ defaultMain [
+ bgroup "getCurrentTime" [
+ bench "old" $ nfIO O.getCurrentTime,
+ bench "new" $ nfIO getCurrentTime
+ ],
+ bgroup "getPOSIXTime" [
+ bench "old" $ nfIO O.getPOSIXTime,
+ bench "new" $ nfIO getPOSIXTime
+ ],
+ bgroup "getSystemTime" [
+ bench "new" $ nfIO getSystemTime
+ ],
+ bgroup "getTimeZone" [
+ bench "old" $ nfIO $ O.getTimeZone oct,
+ bench "new" $ nfIO $ getTimeZone ct
+ ],
+ bgroup "getCurrentTimeZone" [
+ bench "old" $ nfIO O.getCurrentTimeZone,
+ bench "new" $ nfIO getCurrentTimeZone
+ ],
+ bgroup "getZonedTime" [
+ bench "old" $ nfIO O.getZonedTime,
+ bench "new" $ nfIO getZonedTime
+ ],
+ bgroup "formatTime" [
+ bench "old" $ nf (O.formatTime O.defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") oct,
+ bench "new" $ nf (formatTime defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") ct
]
]
More information about the ghc-commits
mailing list