Hi,
i am running some experiments using benchee. The problem is that i want to run the experiments based on the command line arguments.
defmodule A.CLI do
def main(args) do
options = [
switches: [cluster: :integer],
]
{opts, _, _} = OptionParser.parse(args, options)
[{_, cluster_size}] = opts
experiments(cluster_size)
end
def experiments(cluster_size) do
cluster_size = String.to_integer(cluster_size)
Enum.reduce(1..cluster_size, %{}, fn i, acc ->
Map.put(acc, "#{i}", fn -> B.run(1, i) end)
end)
benchee_run()
end
def benchee_run(map) do
Benchee.run(
map,
formatters: [
Benchee.Formatters.Console
]
)
end
end
When i run the experiments in .exs file then i dont get ant errors but while running in an .ex file which is compiled by beam then i get this error
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is
implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict,
HashSet, IO.Stream, Jason.OrderedObject, List, Map, MapSet, Range, Stream
(elixir 1.13.0) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.13.0) lib/enum.ex:143: Enumerable.reduce/3
(elixir 1.13.0) lib/enum.ex:4143: Enum.reduce/3
(benchee 1.0.1) lib/benchee/configuration.ex:308: Benchee.Configuration.standardize_inputs/1
(benchee 1.0.1) lib/benchee/configuration.ex:291: Benchee.Configuration.init/1
(benchee 1.0.1) lib/benchee.ex:45: Benchee.run/2
(elixir 1.13.0) lib/kernel/cli.ex:126: anonymous fn/3 in Kernel.CLI.exec_fun/2