chronos-bench: Benchmarking tool with focus on comparing results.

[ benchmarking, bsd3, development, library, performance, program, testing ] [ Propose Tags ] [ Report a vulnerability ]

This tool performs lazy benchmarking of functions and shell commands with continuous feedback and improving precision.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.1, 0.1.0.2, 0.2.0.1, 0.2.0.2
Change log CHANGELOG.md
Dependencies ansi-terminal, base (>=4 && <5), bytestring, chronos, chronos-bench, containers, deepseq, optparse-applicative, process, terminal-size [details]
Tested with ghc ==8.4.4, ghc ==8.6.3, ghc ==8.6.4
License BSD-3-Clause
Copyright 2019, Florian Knupfer
Author Florian Knupfer
Maintainer fknupfer@gmail.com
Category Development, Performance, Testing, Benchmarking
Home page https://github.com/knupfer/chronos
Source repo head: git clone https://github.com/knupfer/chronos
Uploaded by knupfer at 2019-03-10T17:03:39Z
Distributions LTSHaskell:0.2.0.2, NixOS:0.2.0.2
Executables chronos
Downloads 1959 total (20 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-03-10 [all 1 reports]

Readme for chronos-bench-0.2.0.2

[back to package description]

Chronos

chronos performs lazy benchmarking of shell commands with continuous feedback and improving precision.

Please look at the documentation of the module for an overview of the api: Chronos.Bench

How does it work?

chronos will benchmark the specified commands until you abort it with ctrl-c or it reaches some termination criterion specified by the command line. It updates every iteration the measurements of the benchmarks so you can terminate it when you're satisfied with the presented precision. It will intersperse all benchmarks for fastest possible overview and to distribute any external load over all benchmarks to improve precision.

chronos

Options

chronos presents rich command line options.

options

You can as well use autocomplete of your shell with following command:

source <(chronos --bash-completion-script `which chronos`)

Normally, the output of --bash-completion-script should be coppied in the appropriate directory.

Library

You can use chronos as a haskell library to benchmark pure or impure functions or shell commands.

module Main where

import Chronos.Bench

main :: IO ()
main = defaultMain
  [ bench "fib 1" fib 1
  , bench "fib 2" fib 2
  , bench "fib 4" fib 4
  , bench "fib 8" fib 8
  ]

fib :: Int -> Int
fib 1 = 1
fib 2 = 1
fib n = fib (n-1) + fib (n-2)
module Main where

import Chronos.Bench

import Control.Concurrent
import Data.IORef

main :: IO ()
main = defaultMain
  [ benchIO "ioref" (newIORef True)
  , benchIO "mvar"  (newMVar True)
  , benchIO "qsem"  (newQSem 5)
  , benchIO "chan"  (newChan :: IO (Chan Int))
  ]
module Main where

import Chronos.Bench

main :: IO ()
main = defaultMain
  [ benchShell "sleep is slow"  "sleep 0"
  , benchShell "echo is fast"   "echo"
  , benchShell "true is faster" "true"
  ]

Comparison

Comparing chronos to bench and hyperfine:

chronos

  • intersperses all benchmarks, therefore allowing you fast comparisons
  • uses scientific notation
  • is more robust to external loads because ouf the interspersing (it will affect all benchmarks and not only some)
  • uses a number of significant digits according to the current standard error (so with time more digits are presented and not always 4 which is often the wrong thing to do)
  • uses bars with confidence intervals on the command line for easy comparison

Comparing chronos to criterion:

chronos

  • has got a much simpler api
  • can be used in testsuites
  • has got much simpler internals
  • has got less dependencies
  • doesn't measure allocations
  • doesn't measure cpu time