Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TCO vs. non TCO with 10_000_000 elements
tobi@happy ~/github/elixir_playground $ mix run bench/my_map_bench.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: 10.0s
time: 30.0s
parallel: 1
Estimated total run time: 360.0s
Benchmarking exactly_like_my_map...
Benchmarking map TCO no reverse...
Benchmarking map simple without TCO...
Benchmarking map with TCO reverse...
Benchmarking map with TCO reverse at acc...
Benchmarking map with TCO reverse new acc...
Benchmarking map with TCO reverse new arg order...
Benchmarking my_map...
Benchmarking stdlib map...
Name ips average deviation median
map TCO no reverse 5.26 190.18 ms ±10.81% 194.38 ms
map with TCO reverse new arg order 4.61 216.98 ms ±12.75% 206.13 ms
my_map 4.60 217.39 ms ±13.01% 206.47 ms
exactly_like_my_map 4.57 218.65 ms ±13.80% 205.51 ms
map with TCO reverse at acc 4.25 235.07 ms ±12.27% 220.51 ms
map with TCO reverse 4.24 235.68 ms ±12.37% 222.78 ms
map with TCO reverse new acc 4.24 236.06 ms ±11.95% 225.56 ms
map simple without TCO 2.67 374.34 ms ±4.88% 372.32 ms
stdlib map 2.67 374.75 ms ±5.48% 373.14 ms
Comparison:
map TCO no reverse 5.26
map with TCO reverse new arg order 4.61 - 1.14x slower
my_map 4.60 - 1.14x slower
exactly_like_my_map 4.57 - 1.15x slower
map with TCO reverse at acc 4.25 - 1.24x slower
map with TCO reverse 4.24 - 1.24x slower
map with TCO reverse new acc 4.24 - 1.24x slower
map simple without TCO 2.67 - 1.97x slower
stdlib map 2.67 - 1.97x slower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.