I am thinking about writing support for ExUnit-style benchmarks (if there is no work toward such thing yet). And I am having something like that in mind:
defmodule SampleBench do
use Benchee.Unit
bench do
input "Small (1 Thousand)", do: Enum.to_list(1..1_000)
input "Middle (100 Thousand)", do: Enum.to_list(1..100_000)
setup_all input do
{Enum.shuffle(input), fn i -> [i, i + 1] end}
end
func "flat_map", {input, func} do
Enum.flat_map(input, func)
end
func "map.flatten", {input, func} do
input |> Enum.map(func) |> List.flatten
end
end
end
Any suggestions or other propositions for the syntax?
I am thinking about writing support for ExUnit-style benchmarks (if there is no work toward such thing yet). And I am having something like that in mind:
Any suggestions or other propositions for the syntax?