-
-
Save epicallan/08fb76dea21e36d2eb818ccaecbb1f0c to your computer and use it in GitHub Desktop.
How long is your Template Haskell taking to run?
This file contains 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
timestamp :: String -> Q a -> Q a | |
timestamp name action = do | |
start <- runIO getCurrentTime | |
runIO $ putStrLn $ "Starting " <> name <> ": " <> show start | |
a <- action | |
end <- runIO getCurrentTime | |
runIO $ do | |
putStrLn $ "Ending " <> name <> ": " <> show end | |
putStrLn $ "Elapased " <> name <> ": " <> show (diffUTCTime end start) | |
pure a | |
-- used like: | |
timestamp "persistent models" $ share [mkPersist persistSettings] | |
$(timestamp "persistent parsing" $ persistFileWith lowercaseSettings "file") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment