-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Enhancement of the "criterion" benchmarking library -- -- A dome library over "criterion", which enhances it with the following -- features: -- --
-- import CriterionPlus -- import qualified SomeMySQLLib as MySQL -- import qualified SomePostgreSQLLib as PostgreSQL -- -- main = -- benchmark $ do -- standoff "Inserting rows" $ do -- subject "MySQL" $ do -- -- Exclude the "setup" phase from measurement: -- pause -- connection <- liftIO $ MySQL.openConnection -- -- Measure what we want: -- continue -- liftIO $ MySQL.insertAThousandRows connection -- -- Exclude the "teardown" phase from measurement: -- pause -- liftIO $ MySQL.closeConnection connection -- subject "PostgreSQL" $ do -- -- This is how we can exclude the "setup" phase from monad transformers: -- pause -- PostgreSQL.runSession $ do -- lift $ continue -- PostgreSQL.insertAThousandRows -- -- Exclude "teardown": -- lift $ pause -- -- Each standoff generates an independent report file: -- standoff "Querying" $ do -- subject "MySQL" $ error "So on..." -- subject "PostgreSQL" $ error "So on..." --module CriterionPlus -- | Parse the command line options and run the benchmark. benchmark :: Benchmark () -> IO () -- | A root of the "criterion-plus" monad stack. -- -- Use this monad to declare standoffs. You can also lift a shared -- initialization into it using liftIO. data Benchmark a -- | Declare a named comparison of multiple subjects. This will generate a -- separate report file. standoff :: Name -> Standoff () -> Benchmark () -- | A monad for declaration of independent comparison, which will produce -- a dedicated report file. -- -- Use this monad to group and declare subjects. You can -- also lift a shared initialization into it using liftIO. data Standoff a -- | Put the wrapped computations into a named group. Can be nested. group :: Name -> Standoff () -> Standoff () -- | Execute a named subject. subject :: Name -> Subject a -> Standoff () -- | A monad, which wraps the benchmarking subject and controls its -- measurement. data Subject a -- | Continue the timer. -- -- By default it is already running, so if you need to eclude something -- from the beginning of the subject use pause. E.g.: -- --
-- subject "MySQL" $ do -- pause -- connection <- liftIO $ openConnection -- continue -- liftIO $ workWithConnection connection -- pause -- liftIO $ closeConnection connection --continue :: Subject () -- | Pause the timer. pause :: Subject () -- | An adaptation of Criterion.Types.whnf. whnf :: MonadIO m => (a -> b) -> a -> m () -- | An adaptation of Criterion.Types.nf. nf :: (MonadIO m, NFData b) => (a -> b) -> a -> m () -- | An adaptation of Criterion.Types.nfIO. nfIO :: (MonadIO m, NFData a) => IO a -> m () -- | An adaptation of Criterion.Types.whnfIO. whnfIO :: MonadIO m => IO a -> m () type Name = StrictText