Created
January 30, 2017 11:37
-
-
Save ghatighorias/2332ddbb0d40cfdda95c80f780341858 to your computer and use it in GitHub Desktop.
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
defmodule Benchmark do | |
def run do | |
map_fun = fn(element) -> element + 1 end | |
inputs = %{ | |
"small" => Enum.to_list(1..10_000), | |
"medium" => Enum.to_list(1..100_000), | |
"big" => Enum.to_list(1..1_000_000), | |
"verybig" => Enum.to_list(1..5_000_000) | |
} | |
Benchee.run(%{ | |
"tail-recursive" => fn(list) -> MyMap.map_tco(list, map_fun) end, | |
"std-lib map" => fn(list) -> Enum.map(list, map_fun) end, | |
"body-recursive" => fn(list) -> MyMap.map_body(list, map_fun) end | |
}, time: 20, warmup: 10, inputs: inputs) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment