Created
October 13, 2016 08:04
-
-
Save pragtobgists/8e05c96083c8f53afa43cc7788da4d04 to your computer and use it in GitHub Desktop.
Run with smallest scaling
This file contains hidden or 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(%{time: 3, console: %{unit_scaling: :smallest}}, %{ | |
| "flat_map" => fn -> Enum.flat_map(list, map_fun) end, | |
| "map.flatten" => fn -> list |> Enum.map(map_fun) |> List.flatten end | |
| }) |
This file contains hidden or 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
| tobi@happy ~/github/benchee $ mix run samples/run.exs | |
| Erlang/OTP 19 [erts-8.1] [source-4cc2ce3] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] | |
| Elixir 1.3.4 | |
| Benchmark suite executing with the following configuration: | |
| warmup: 2.0s | |
| time: 3.0s | |
| parallel: 1 | |
| Estimated total run time: 10.0s | |
| Benchmarking flat_map... | |
| Benchmarking map.flatten... | |
| Name ips average deviation median | |
| map.flatten 1251.52 799.03 μs ±15.45% 762.00 μs | |
| flat_map 849.87 1176.65 μs ±4.54% 1189.00 μs | |
| Comparison: | |
| map.flatten 1251.52 | |
| flat_map 849.87 - 1.47x slower |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment