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

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

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


[Skip to Readme]
Versions [faq] 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.*), bytestring, chronos, chronos-bench, containers, deepseq, optparse-applicative, process, terminal-size [details]
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 Sun Mar 10 17:03:39 UTC 2019
Distributions NixOS:0.2.0.2, Stackage:0.2.0.2
Executables chronos
Downloads 74 total (3 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-03-10 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


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