A simple and flexible benchmarking library for PureScript.
-
Customizable Output – Choose between console logging, JSON reports, HTML or Markdown summaries with rendered charts.
-
Flexible Benchmarking – Configure iterations, input sizes, and setup functions.
-
Supports Pure & Effectful Functions – Benchmark any kind of computation.
-
Just PureScript – No JavaScript libraries under the hood, ensuring full type safety.
Focus on writing benchmarks, not boilerplate.
-
Currently, the library only supports Node.js. However, it's planned to add browser support in the future.
-
The library is still in its early stages, and we welcome contributions to improve it.
module Test.Samples.Minimal where
import Prelude
import BenchLib (basic, group_, suite_, bench_)
import BenchLib as BenchLib
import Data.Array as Array
import Data.List.Lazy as LazyList
import Effect (Effect)
--- Main
main :: Effect Unit
main = BenchLib.runNode_ $
suite_
"Minimal Example"
[ group_ "Replicate Functions"
[ basic $ bench_
"Array"
identity
(\size -> Array.replicate size 'x')
, basic $ bench_
"Lazy List"
identity
(\size -> LazyList.replicate size 'x')
]
]
After defining your benchmarks, you can run them from the terminal using spago
:
spago run -m Test.Samples.Minimal