[Haskell-cafe] Criterion setup/teardown functions?

Thomas Schilling nominolo at googlemail.com
Tue Jul 17 22:10:30 CEST 2012

On 17 July 2012 20:45, tsuraan <tsuraan at gmail.com> wrote:
> Is there anything in Criterion that allows for a benchmark to run some
> code before or after the thing that it's timing?  As an example, I'd
> like to time a bunch of database inserts, but beforehand I want to
> create the target table, and afterwards I'd like to delete it.  I
> don't really care to have the time spent on the create/delete recorded
> in the test run's timing, if that's possible to do.

See the second argument of "defaultMainWith"

The Criterion monad supports running arbitrary IO actions via "liftIO".

/ Thomas

More information about the Haskell-Cafe mailing list