birl icon indicating copy to clipboard operation
birl copied to clipboard

Birl appropriate for benchmarking?

Open bcpeinhardt opened this issue 9 months ago • 2 comments

Hey there! I'm doing some very basic benchmarking with the following

fn time(name: String, f: fn() -> a) -> a {
  let start = birl.now()
  let x = f()
  let end = birl.now()
  let difference = birl.difference(end, start) |> duration.blur_to(duration.MilliSecond)
  io.println(name <> " took: " <> int.to_string(difference) <> "ms")
  x
}

which I use like

let parallel_freq = time("parallel", fn() { parallel_letter_frequency(workload, 200_000) })

My question is

  1. Is using Birl for benchmarking this way appropriate and
  2. Would a more general timer function be a useful addition?

bcpeinhardt avatar May 09 '24 02:05 bcpeinhardt