From f4ce3699985333e00dbece0642f8bdec6f3a4252 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 30 Nov 2020 23:11:12 -0500 Subject: [PATCH] Add benchmark module --- lib/benchmark.ex | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lib/benchmark.ex diff --git a/lib/benchmark.ex b/lib/benchmark.ex new file mode 100644 index 0000000..f3b1445 --- /dev/null +++ b/lib/benchmark.ex @@ -0,0 +1,8 @@ +defmodule Benchmark do + def measure(function) do + function + |> :timer.tc() + |> elem(0) + |> Kernel./(1_000_000) + end +end