birl
birl copied to clipboard
Birl appropriate for benchmarking?
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
- Is using Birl for benchmarking this way appropriate and
- Would a more general timer function be a useful addition?