Glychee · A Simple Gleam Benchmark Runner

Hex Package Hex Docs License

A simple Gleam benchmark runner which wraps Benchee for the heavy lifting.

Named after Gleam, Benchee and their fruity Lychee offspring:

Glychee Logo
Imaginary Glychees


Quick start

  1. Add Glychee to your project: gleam add glychee.

  2. Create a custom benchmarking module for example named my_benchmark that contains a main-function. In that module you will define which Functions to benchmark with one or many Data.

  3. Run the benchmark:

    gleam clean && \
    gleam build && \
    erl -pa ./build/dev/erlang/*/ebin -noshell -eval 'gleam@@main:run(my_benchmark)'

Full example

If you do not have a Gleam project yet, create it with:

gleam new foobar
cd foobar

Add Glychee: gleam add glychee, then in your project create a file named src/benchmark.gleam with following source code:

if erlang {
  import gleam/int
  import gleam/list
  import glychee/benchmark

  pub fn main() {
          label: "list.sort()",
          callable: fn(test_data) {
            fn() {
          label: "pre-sorted list",
          data: list.range(1, 100_000),
          label: "reversed list",
          data: list.range(1, 100_000) |> list.reverse,

Then run in your terminal via:

gleam clean && \
gleam build && \
erl -pa ./build/dev/erlang/*/ebin -noshell -eval 'gleam@@main:run(benchmark)'

Now you can alter the functions and data specified in above’s example to whichever function of your application or library you want to benchmark.

Note that you can benchmark multiple functions with different data sets in one go.


Glychee’s documentation can be found at


Apache 2.0

Search Document