Current section
Files
Jump to
Current section
Files
lib/mix/tasks/benchmark.ex
defmodule Mix.Tasks.BlsEx.Benchmark do
@nb_keys 197
def run(_) do
keys =
Enum.map(1..@nb_keys, fn _ ->
pv = :crypto.strong_rand_bytes(64)
pb = BlsEx.get_public_key!(pv)
{pb, pv}
end)
sigs = Enum.map(keys, fn {pb, pv} -> {pb, BlsEx.sign!(pv, "hello")} end)
inputs =
50..200//50
|> Enum.map(&{&1, Enum.take(sigs, &1) |> Enum.unzip()})
|> Map.new()
Benchee.run(
%{
"aggregate" => &BlsEx.aggregate_signatures!(elem(&1, 1), elem(&1, 0))
},
inputs: inputs
)
end
end