Current section
Files
Jump to
Current section
Files
lib/benchmark/collection.ex
defmodule Panty.Benchmark.Collection do
alias Panty.Collection
def ben_collection do
list = 1..10000 |> Enum.to_list()
half = 9989..19999 |> Enum.to_list()
hyphen_way = fn(list, half) -> (list -- (list --half)) end
Benchee.run(%{
"use.intersection" => fn -> Collection.intersection(list, half) end,
"use.hyphens" => fn -> hyphen_way.(list, half) end
})
long_collection = 1..10000000 |> Enum.to_list()
Benchee.run(%{
"use.initial.elixir" => fn -> Panty.Collection.initial(long_collection) end,
"use.initial.erlang" => fn -> :lists.droplast(long_collection) end
})
end
end