small framework for performance measurement and analysis

Version on this page:0.1.3
LTS Haskell 11.6:0.2.1
Stackage Nightly 2018-04-26:0.2.1
Latest on Hackage:0.2.1

See all snapshots gauge appears in

BSD3 licensed by Bryan O'Sullivan
Maintained by Vincent Hanquez

Module documentation for 0.1.3

Gauge: a clone of criterion

This is a clone of criterion with a code / dependencies on a diet. It works the same way as criterion for outputing to terminal benchmark data.

features compared to criterion


  • JSON export
  • HTML/javascript pages
  • Glob benchmark matching


  • Small condensed output (-s or --small)
  • Raw measurements dumping (CSV)

Future Feature Plan

  • Remove further dependencies
  • storing benchmarks data in CSV and JSON
  • Add a standalone program taking benchmark data files and rendering to html/javascript/graphs
  • Make the library more useful as a standalone library to gather benchmark numbers related to functions in a programatic way

Small mode

It's hard to compare many benchmarks with criterion, so gauge has a --small output:

identity                                 mean 41.65 ns  ( +- 2.246 ns  )
slow                                     mean 163.9 ns  ( +- 9.683 ns  )

Direct dependencies removed compared to criterion

Number of total dependencies (direct & indirect):

  • gauge: 12 dependencies
  • criterion: 63 dependencies

Dependencies removed:

  • Glob 0.8.0
  • abstract-deque 0.3
  • abstract-par 0.3.3
  • aeson
  • ansi-terminal
  • ansi-wl-pprint
  • array
  • attoparsec
  • base-compat 0.9.3
  • base-orphans 0.6
  • binary
  • blaze-builder
  • bytestring
  • cassava
  • cereal
  • code-page 0.1.3
  • containers
  • criterion
  • directory
  • dlist
  • erf
  • exceptions 0.8.3
  • filepath
  • ghc-boot-th 8.0.2
  • hashable
  • integer-gmp
  • integer-logarithms 1.0.2
  • js-flot 0.8.3
  • js-jquery 3.2.1
  • math-functions
  • microstache
  • monad-par
  • monad-par-extras 0.3.3
  • mtl 2.2.1
  • mwc-random
  • optparse-applicative
  • parallel
  • parsec 3.1.11
  • pretty
  • process
  • random 1.1
  • scientific
  • statistics
  • stm
  • tagged 0.8.5
  • template-haskell
  • text
  • time
  • time-locale-compat
  • transformers-compat
  • unix
  • unordered-containers
  • uuid-types 1.0.3
  • vector-algorithms
  • vector-binary-instances
  • vector-th-unbox

Criterion graph of dependencies:


Gauge graph of dependencies:




  • Inline math-functions & mwc-random: Remove most functions, instances and types, that are unnecessary for gauge Remove unsafe seeding with partial seed (unused in gauge anyway) Remove vector-th-unbox dependency (transitively template-haskell, pretty, ghc-boot-th) Remove time dependency
  • Re-add Gauge.Benchmark to Gauge.Main to keep the transition between criterion and gauge easy
  • Fix cycles reporting on linux, osx and windows
  • Add some extra callstack for reporting on partial function
  • Fix compilation with Semigroup => Monoid (compilation on 8.4). still unsupported
  • Add some color on terminal output


  • Usability: Simplify and organize the documentation and user APIs.
  • Functionality: Add measurement and reporting of more performance counters on Unices (collected via getrusage) for example page faults, user time, system time and rss are now available in verbose mode. Re-enable CSV analysis with the same output format as criterion (--csv) * Add CSV measurement dumping with --csvraw
  • Control: Provide better control over measurement process with --min-samples, --min-duration and --include-first-iter flags.
  • Speed: Add --quick flag that provides results much faster (10x) without using statistical analysis.
  • Reliability: Fix a bug in GC stats collection and reporting with GHC 8.2 that caused incorrect reporting of some GC stats. Fix a bug in statistical regression that caused incorrect reporting of mean and other stats. Improve reliability by isolating benchmarks from one another using the --measure-with flag. The results of one benchmark are no longer affected by other benchmarks because each benchmark runs in a separate process. Introduce an optional value type Optional with an efficient runtime representation to replace the ad-hoc fromXXX functions and the untyped approach.
  • Modularity: Introduce --measure-only flag that allows just measurement and no analysis or reporting. Provide modular build, measurement code is cleanly separated from statistical analysis code. As a result a leaner version can now be built without analysis code (controlled by the analysis build flag). * Clean, refactor & rewrite source code
  • Remove code-page dependency


  • Simplify monad handling, remove foundation as dependency


  • condensed display with --small


  • remove optparse-applicative


  • remove bunch of dependencies
  • initial import of criterion-
Depends on 6 packages:
comments powered byDisqus