Benchmarking

Purescript has a few benchmarking libraries:

NameStatusComments
purescript-benchotron (my fork)Up-to-dateUses QuickCheck
Output results only in Node
Results are viewable only via graphs
purescript-benchotron (original)Up-to-dateUses QuickCheck
Output results only in Node
Results are viewable only via graphs
purescript-minibenchUp-to-dateProvides quick estimates but not very accurate benchmarks
purescript-benchmarkOutdated (PS 0.11.7)Doesn't require QuickCheck
Outputs results in Node and Browser
Output is full ASCII table with percentage values

In this folder, we'll be covering benchotron because it works for 0.15.x and has finer accuracy than minibench and includes graphs.

This benchotron graph...

benchmark results

... was the result of this somewhat unreadable output

Compilation Instructions

Benchotron is a Purescript library that provides bindings to Benchmark.js. Follow these commands to set up this folder:

  1. Install Benchmark.js locally via the command below:
# Note: This must be installed locally for the code to work.
# If you install it globally, Node won't be able to find `benchmark`.
npm install benchmark
  1. Use spago to build the program::
# 'spago build' includes a call to 'spago install'
spago build

You can now use benchotron via spago.

Generating benchmark results

  1. Run the below command
# Since we have `"benchmark/**/*.purs"` included in
# the `spago.dhall` file's "sources" config, we can use
# the below command instead. If you don't that that,
# you'll need to add '-p "benchmark/**/*.purs"' as an argument below.
spago run -m Benchmarking.Syntax.Benchotron
  1. It will output a file in the freshly-created tmp directory
  2. Upload the outputted file to the Benchotron SVG Renderer
  3. Download the graph as an SVG or PNG