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
tobi@speedy:~/github/elixir_boards_benchmark(master)$ mix run benchmark.exs | |
================= Getting and setting full board ==================== | |
Operating System: Linux | |
CPU Information: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz | |
Number of Available Cores: 8 | |
Available memory: 15.61 GB | |
Elixir 1.8.2 |
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 Board do | |
# can't be more specific witht types as each implementation has its own representation | |
@type board :: any | |
@type field :: any | |
@callback new() :: board | |
@callback get(board, non_neg_integer, non_neg_integer) :: field | |
@callback set(board, non_neg_integer, non_neg_integer, field) :: board | |
end |
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
pick_up_task = Task.async(fn -> geocode(pick_up_address) end) | |
drop_off_task = Task.async(fn -> geocode(drop_off_address) end) | |
geocoded_addresses = Enum.map([pick_up_task, drop_off_task], fn task -> Task.await(task) end) |
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
Operating System: Linux | |
CPU Information: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz | |
Number of Available Cores: 8 | |
Available memory: 15.61 GB | |
Elixir 1.8.1 | |
Erlang 21.3.2 | |
Benchmark suite executing with the following configuration: | |
warmup: 2 s | |
time: 5 s |
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
map_fun = fn i -> i + 1 end | |
inputs = [ | |
{"Small (10 Thousand)", Enum.to_list(1..10_000)}, | |
{"Middle (100 Thousand)", Enum.to_list(1..100_000)}, | |
{"Big (1 Million)", Enum.to_list(1..1_000_000)}, | |
{"Bigger (5 Million)", Enum.to_list(1..5_000_000)}, | |
{"Giant (25 Million)", Enum.to_list(1..25_000_000)} | |
] |
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
tc(F) -> | |
T1 = erlang:monotonic_time(), | |
Val = F(), | |
T2 = erlang:monotonic_time(), | |
Time = erlang:convert_time_unit(T2 - T1, native, microsecond), | |
{Time, Val}. |
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
range = 1..10 | |
integer1 = :rand.uniform(100) | |
integer2 = :rand.uniform(100) | |
Benchee.run( | |
%{ | |
"Integer addition (wrong)" => fn -> 1 + 1 end, | |
"Integer addition" => fn -> integer1 + integer2 end, | |
"String concatention (wrong)" => fn -> "1" <> "1" end, | |
"adding a head to an array (wrong)" => fn -> [1 | [1]] end, |
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
Benchee.run( | |
%{ | |
"function" => fn -> something end | |
}, | |
formatters: [ | |
{Benchee.Formatters.HTML, file: "output/my.html", auto_open: false, inline_assets: true}, | |
Benchee.Formatters.Console | |
] | |
) |
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
Benchee.run( | |
%{ | |
"function" => fn -> something end | |
}, | |
formatters: [ | |
Benchee.Formatters.HTML, | |
Benchee.Formatters.Console | |
], | |
formatter_options: [ | |
html: [file: "output/my.html", auto_open: false, inline_assets: true] |
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
tobi@liefy:~$ ping 192.168.0.1 | |
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. | |
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=7.46 ms | |
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=4.83 ms | |
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=4.26 ms | |
64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=4.01 ms | |
64 bytes from 192.168.0.1: icmp_seq=5 ttl=64 time=6.69 ms | |
64 bytes from 192.168.0.1: icmp_seq=6 ttl=64 time=4.93 ms | |
64 bytes from 192.168.0.1: icmp_seq=7 ttl=64 time=8.30 ms | |
64 bytes from 192.168.0.1: icmp_seq=8 ttl=64 time=4.17 ms |