|
1 | 1 | list_10k = 1..10_000 |> Enum.to_list() |> Enum.shuffle() |
2 | 2 | list_100k = 1..100_000 |> Enum.to_list() |> Enum.shuffle() |
| 3 | +list_1M = 1..1_000_000 |> Enum.to_list() |> Enum.shuffle() |
3 | 4 |
|
4 | | -Benchee.run(%{"10k" => fn -> Enum.sort(list_10k) end, "100k" => fn -> Enum.sort(list_100k) end}) |
| 5 | +Benchee.run( |
| 6 | + [ |
| 7 | + {"10k", fn -> Enum.sort(list_10k) end}, |
| 8 | + {"100k", fn -> Enum.sort(list_100k) end}, |
| 9 | + {"1M", fn -> Enum.sort(list_1M) end} |
| 10 | + ], |
| 11 | + memory_time: 2 |
| 12 | +) |
5 | 13 |
|
| 14 | +# tobi@qiqi:~/github/benchee(max-sample-size)$ mix run samples/sort_performance.exs |
6 | 15 | # Operating System: Linux |
7 | | -# CPU Information: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz |
8 | | -# Number of Available Cores: 8 |
9 | | -# Available memory: 15.61 GB |
10 | | -# Elixir 1.8.1 |
11 | | -# Erlang 21.3.2 |
| 16 | +# CPU Information: AMD Ryzen 9 5900X 12-Core Processor |
| 17 | +# Number of Available Cores: 24 |
| 18 | +# Available memory: 31.26 GB |
| 19 | +# Elixir 1.18.3 |
| 20 | +# Erlang 27.3.2 |
| 21 | +# JIT enabled: true |
12 | 22 |
|
13 | 23 | # Benchmark suite executing with the following configuration: |
14 | 24 | # warmup: 2 s |
15 | 25 | # time: 5 s |
16 | | -# memory time: 0 ns |
| 26 | +# memory time: 2 s |
| 27 | +# reduction time: 0 ns |
17 | 28 | # parallel: 1 |
18 | 29 | # inputs: none specified |
19 | | -# Estimated total run time: 14 s |
| 30 | +# Estimated total run time: 27 s |
20 | 31 |
|
21 | | -# Benchmarking 100k... |
22 | | -# Benchmarking 10k... |
| 32 | +# Benchmarking 10k ... |
| 33 | +# Benchmarking 100k ... |
| 34 | +# Benchmarking 1M ... |
| 35 | +# Calculating statistics... |
| 36 | +# Formatting results... |
23 | 37 |
|
24 | 38 | # Name ips average deviation median 99th % |
25 | | -# 10k 722.79 1.38 ms ±10.21% 1.37 ms 1.77 ms |
26 | | -# 100k 56.70 17.64 ms ±6.38% 17.34 ms 22.84 ms |
| 39 | +# 10k 1237.97 0.81 ms ±28.70% 0.73 ms 1.42 ms |
| 40 | +# 100k 74.50 13.42 ms ±40.13% 10.96 ms 31.42 ms |
| 41 | +# 1M 6.17 162.05 ms ±34.38% 146.08 ms 328.83 ms |
27 | 42 |
|
28 | 43 | # Comparison: |
29 | | -# 10k 722.79 |
30 | | -# 100k 56.70 - 12.75x slower +16.25 ms |
| 44 | +# 10k 1237.97 |
| 45 | +# 100k 74.50 - 16.62x slower +12.62 ms |
| 46 | +# 1M 6.17 - 200.61x slower +161.24 ms |
| 47 | + |
| 48 | +# Memory usage statistics: |
| 49 | + |
| 50 | +# Name Memory usage |
| 51 | +# 10k 1.42 MB |
| 52 | +# 100k 18.59 MB - 13.09x memory usage +17.17 MB |
| 53 | +# 1M 218.22 MB - 153.62x memory usage +216.80 MB |
| 54 | + |
| 55 | +# **All measurements for memory usage were the same** |
0 commit comments