Last active
July 12, 2016 07:07
-
-
Save pragtobgists/d6a970e975ea56718eff9c5930171d3d to your computer and use it in GitHub Desktop.
Mutliple formatters in benchee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = Enum.to_list(1..10_000) | |
map_fun = fn(i) -> [i, i * i] end | |
Benchee.run( | |
%{ | |
formatters: [ | |
&Benchee.Formatters.CSV.output/1, | |
&Benchee.Formatters.Console.output/1 | |
], | |
csv: %{file: "my.csv"} | |
}, | |
%{ | |
"flat_map" => fn -> Enum.flat_map(list, map_fun) end, | |
"map.flatten" => fn -> list |> Enum.map(map_fun) |> List.flatten end | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment