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
list = Enum.to_list(1..10_000) | |
map_fun = fn i -> [i, i * i] end | |
Benchee.run( | |
%{ | |
"flat_map" => fn -> Enum.flat_map(list, map_fun) end, | |
"map.flatten" => fn -> list |> Enum.map(map_fun) |> List.flatten() end | |
}, | |
reduction_time: 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
tobi@speedy:~$ uname -a | |
Linux speedy 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux | |
tobi@speedy:~$ lscpu | |
Architecture: x86_64 | |
CPU op-mode(s): 32-bit, 64-bit | |
Byte Order: Little Endian | |
CPU(s): 8 | |
On-line CPU(s) list: 0-7 | |
Thread(s) per core: 2 | |
Core(s) per socket: 4 |
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/rubykon(main)$ ruby --jvm -v | |
truffleruby 20.1.0, like ruby 2.6.5, GraalVM CE JVM [x86_64-linux] | |
tobi@speedy:~/github/rubykon(main)$ ruby --jvm --experimental-options --engine.TraceTransferToInterpreter --engine.BackgroundCompilation=false benchmark/mcts_avg.rb | |
Running your benchmark... | |
-------------------------------------------------------------------------------- | |
[engine] transferToInterpreter at | |
Array#[]((core):1) <split-133c56f7> | |
Rubykon::Board#neighbours_of(lib/rubykon/board.rb:50) | |
Rubykon::MoveValidator#no_suicide_move?(lib/rubykon/move_validator.rb:38) | |
Rubykon::MoveValidator#trusted_valid?(lib/rubykon/move_validator.rb:18) |
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.9.1 | |
Erlang 22.0 | |
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
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.9.0 | |
Erlang 22.0 | |
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
Using Java adoptopenjdk-8.212 | |
Running jruby-9.1.17.0 | |
jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 OpenJDK 64-Bit Server VM 25.212-b03 on 1.8.0_212-b03 +jit [linux-x86_64] | |
Running your benchmark... | |
-------------------------------------------------------------------------------- | |
Finished warm up for 19x19 1_000 iterations, running the real bechmarks now | |
Finished measuring the run time for 19x19 1_000 iterations | |
Benchmarking finished, here are your reports... | |
Warm up results: |
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
iex> Statistex.variance([4, 9, 11, 12, 17, 5, 8, 12, 12], sample_size: 9, average: 10.0) | |
16.0 |
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
iex> samples = [1, 3.0, 2.35, 11.0, 1.37, 35, 5.5, 10, 0, 2.35] | |
iex> Statistex.statistics(samples) | |
%Statistex{ | |
average: 7.156999999999999, | |
frequency_distribution: %{ | |
0 => 1, | |
1 => 1, | |
10 => 1, | |
35 => 1, | |
1.37 => 1, |
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
check all samples <- list_of(float(), min_length: 1) do | |
percies = percentiles(samples, [25, 50, 75, 90, 99]) | |
assert percies[25] <= percies[50] | |
assert percies[50] <= percies[75] | |
assert percies[75] <= percies[90] | |
assert percies[90] <= percies[99] | |
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
check all samples <- list_of(float(), min_length: 1) do | |
stats = statistics(samples) | |
assert stats.sample_size >= 1 | |
assert stats.minimum <= stats.maximum | |
assert stats.minimum <= stats.average | |
assert stats.average <= stats.maximum | |
assert stats.minimum <= stats.median |