Skip to content

Instantly share code, notes, and snippets.

@NobbZ
Created June 13, 2017 21:37
Show Gist options
  • Save NobbZ/7dac9af7b358054675a1c81ec677340e to your computer and use it in GitHub Desktop.
Save NobbZ/7dac9af7b358054675a1c81ec677340e to your computer and use it in GitHub Desktop.
limit = 10_000_000
factors = [3, 5]
Benchee.run(%{
"evanboho" => fn -> E.to(limit, factors) end,
"muhifauzan" => fn -> M.to(limit, factors) end,
"nobbz" => fn -> N.to(limit, factors) end,
})
limit = 10_000_000
factors = [3, 5, 7]
Benchee.run(%{
"evanboho" => fn -> E.to(limit, factors) end,
"muhifauzan" => fn -> M.to(limit, factors) end,
"nobbz" => fn -> N.to(limit, factors) end,
})
limit = 10_000_000
factors = [3, 5, 10_000_000]
Benchee.run(%{
"evanboho" => fn -> E.to(limit, factors) end,
"muhifauzan" => fn -> M.to(limit, factors) end,
"nobbz" => fn -> N.to(limit, factors) end,
})

This benchmarks the code of three submissions to the exercism "sum of multiples" problem fter a user told that his code were 4 times as fast as some others code.

Since he did not specified how he benchmarked I want to provide my own benchmark here.

Benchmarked are the submissions of these three users (the benched iteration is linked):

Operating System: Linux
CPU Information: Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
Number of Available Cores: 4
Available memory: 8.087904 GB
Elixir 1.4.4
Erlang 19.3
Benchmark suite executing with the following configuration:
warmup: 2.00 s
time: 5.00 s
parallel: 1
inputs: none specified
Estimated total run time: 21.00 s
Benchmarking evanboho...
Benchmarking muhifauzan...
Benchmarking nobbz...
Name ips average deviation median
muhifauzan 0.52 1.93 s ±4.92% 1.87 s
nobbz 0.50 2.01 s ±0.20% 2.01 s
evanboho 0.123 8.12 s ±0.00% 8.12 s
Comparison:
muhifauzan 0.52
nobbz 0.50 - 1.04x slower
evanboho 0.123 - 4.21x slower
Operating System: Linux
CPU Information: Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
Number of Available Cores: 4
Available memory: 8.087904 GB
Elixir 1.4.4
Erlang 19.3
Benchmark suite executing with the following configuration:
warmup: 2.00 s
time: 5.00 s
parallel: 1
inputs: none specified
Estimated total run time: 21.00 s
Benchmarking evanboho...
Benchmarking muhifauzan...
Benchmarking nobbz...
Name ips average deviation median
muhifauzan 0.45 2.21 s ±5.96% 2.18 s
nobbz 0.44 2.29 s ±0.19% 2.29 s
evanboho 0.103 9.72 s ±0.00% 9.72 s
Comparison:
muhifauzan 0.45
nobbz 0.44 - 1.04x slower
evanboho 0.103 - 4.40x slower
Operating System: Linux
CPU Information: Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
Number of Available Cores: 4
Available memory: 8.087904 GB
Elixir 1.4.4
Erlang 19.3
Benchmark suite executing with the following configuration:
warmup: 2.00 s
time: 5.00 s
parallel: 1
inputs: none specified
Estimated total run time: 21.00 s
Benchmarking evanboho...
Benchmarking muhifauzan...
Benchmarking nobbz...
Name ips average deviation median
muhifauzan 0.46 2.15 s ±4.79% 2.08 s
nobbz 0.45 2.24 s ±0.68% 2.25 s
evanboho 0.123 8.13 s ±0.00% 8.13 s
Comparison:
muhifauzan 0.46
nobbz 0.45 - 1.04x slower
evanboho 0.123 - 3.78x slower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment