2. Domácí úkol: Porovnání
using DataFrames, CSV, PyPlot
Import naměřených dat.
data = CSV.read("files/benchmark02.csv", DataFrame);
data[!, :score] = zeros(Int64, nrow(data));
Čas v původních datech je měřen v nanosekundách, paměť v bytech.
Každá hodnota je medián několika běhů benchmarku z balíčku BechmarkTools.jl
.
Všechny výpočty běží na stejných předem vygenerovaných datech a se stejným počátečním nastavením PRNG.
Komentář k jednotlivých sloupců je v příslušné sekci níže.
data = coalesce.(data, 999e99)
Row | username | randomize_periodic | randomize_periodic_mem | randomize_fixed | randomize_fixed_mem | energy_periodic | energy_periodic_mem | energy_fixed | energy_fixed_mem | evolution_periodic | evolution_periodic_mem | evolution_fixed | evolution_fixed_mem | score |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String15 | Float64 | Int64 | Float64 | Int64 | Float64 | Int64 | Float64 | Int64 | Float64 | Float64 | Float64 | Float64 | Int64 | |
1 | kalvotom | 2.42561e7 | 20000000 | 1.96084e7 | 19840320 | 5.28643e7 | 0 | 9.07513e6 | 0 | 1.92786e6 | 496.0 | 9.4502e5 | 496.0 | 0 |
2 | Zuhgan | 1.38882e6 | 2000048 | 1.32805e6 | 1984112 | 4.62317e6 | 0 | 7.69932e6 | 0 | 1.0882e6 | 0.0 | 9.99e101 | 9.99e101 | 0 |
3 | Shum | 1.7031e6 | 0 | 1.85951e6 | 0 | 1.63905e7 | 0 | 1.36044e7 | 0 | 5.64068e5 | 496.0 | 4.76768e5 | 496.0 | 0 |
4 | Parfu | 1.26384e6 | 0 | 1.25036e6 | 0 | 8.71313e6 | 2000048 | 7.3095e6 | 2000048 | 9.96326e6 | 2.00005e6 | 8.46145e6 | 2.00005e6 | 0 |
5 | Borkul | 1.67349e6 | 2000128 | 1.73498e6 | 1984192 | 7.77872e6 | 26002528 | 8.42986e6 | 25929392 | 1.07116e6 | 0.0 | 1.59849e6 | 479744.0 | 0 |
6 | Jogug | 987862.0 | 0 | 657463.0 | 0 | 8.38036e6 | 0 | 2.64698e6 | 0 | 9.17525e6 | 0.0 | 3.01946e6 | 0.0 | 0 |
7 | Wauktug | 2.35325e7 | 20000000 | 1.86072e7 | 19840320 | 2.46943e7 | 2000048 | 1.4021e7 | 2000048 | 2.43321e7 | 0.0 | 2.54885e7 | 0.0 | 0 |
8 | Ugghra | 1.81725e6 | 250096 | 1.79426e6 | 248112 | 8.59678e7 | 94038144 | 8.77562e7 | 80023024 | 8.62513e7 | 9.47793e7 | 1.78556e8 | 8.06234e7 | 0 |
9 | Gilaktug | 2.88251e6 | 2000128 | 2.88865e6 | 1984192 | 1.12575e9 | 1213843856 | 1.10493e9 | 1212687248 | 9.99e101 | 9.99e101 | 9.99e101 | 9.99e101 | 0 |
10 | Xomkug | 1.37509e6 | 2000128 | 1.9081e6 | 1984192 | 1.0907e7 | 30027120 | 8.99903e6 | 25929200 | 2.77365e6 | 8.04981e6 | 4.93034e5 | 0.0 | 0 |
11 | Xunaakt | 1.40303e6 | 2000048 | 1.37489e6 | 2000048 | 1.11213e7 | 0 | 1.08273e7 | 0 | 1.01076e6 | 320000.0 | 413549.0 | 0.0 | 0 |
12 | Saghig | 1.358e6 | 2000128 | 3.92016e6 | 1984112 | 5.23231e7 | 52000000 | 5.35698e7 | 52000000 | 5.44353e7 | 5.24895e7 | 5.61772e7 | 5.24889e7 | 0 |
13 | Bugharz | 3.33323e6 | 2000128 | 3.34088e6 | 1984192 | 1.63152e7 | 22450640 | 8.07758e6 | 10367808 | 1.40377e6 | 595520.0 | 1.52498e6 | 575040.0 | 0 |
14 | Saraugug | 1.63092e6 | 0 | 899446.0 | 0 | 5.0883e6 | 0 | 1.93096e6 | 0 | 5.79478e6 | 0.0 | 1.53793e6 | 0.0 | 0 |
15 | Epkagut | 3.57635e6 | 4071664 | 3.57872e6 | 4071664 | 8.44516e9 | 1020157152 | 1.13433e10 | 1018754336 | 1.61421e10 | 1.38795e9 | 1.09804e10 | 1.38575e9 | 0 |
16 | Xig | 2.79644e6 | 2000128 | 1.84892e6 | 1984256 | 3.09434e6 | 2000048 | 4.95292e6 | 2000048 | 5.66954e9 | 4.00018e9 | 6.06057e9 | 4.00018e9 | 0 |
17 | Quordud | 2.60039e6 | 0 | 2.04182e6 | 0 | 1.31842e7 | 0 | 2.32202e7 | 2000048 | 5.86705e10 | 4.0008e6 | 1.18859e11 | 1.17803e10 | 0 |
Poznámky
- Vedle studentů je v tabulce i můj řádek (
kalvotom
). - Pro lepší porovnání časů provedem vždy relativní porovnání s nejrychlejším časem. Měníme proto hodnoty a význam časových sloupců!
randomize!
Randomizace pomocí Pro měření (i v dalších sekcích níže) je použita mřížka . Nejprve model s periodickými hraničními podmínkami.
data[!, :randomize_periodic] /= minimum(data.randomize_periodic);
sort!(data, [:randomize_periodic]);
for k in axes(data, 1)
data[k, :score] += k
end
data[:, Cols(:username, :randomize_periodic, :randomize_periodic_mem, :score)]
Row | username | randomize_periodic | randomize_periodic_mem | score |
---|---|---|---|---|
String15 | Float64 | Int64 | Int64 | |
1 | Jogug | 1.0 | 0 | 1 |
2 | Parfu | 1.27936 | 0 | 2 |
3 | Saghig | 1.37469 | 2000128 | 3 |
4 | Xomkug | 1.39198 | 2000128 | 4 |
5 | Zuhgan | 1.40588 | 2000048 | 5 |
6 | Xunaakt | 1.42027 | 2000048 | 6 |
7 | Saraugug | 1.65096 | 0 | 7 |
8 | Borkul | 1.69405 | 2000128 | 8 |
9 | Shum | 1.72403 | 0 | 9 |
10 | Ugghra | 1.83958 | 250096 | 10 |
11 | Quordud | 2.63234 | 0 | 11 |
12 | Xig | 2.8308 | 2000128 | 12 |
13 | Gilaktug | 2.91793 | 2000128 | 13 |
14 | Bugharz | 3.37419 | 2000128 | 14 |
15 | Epkagut | 3.6203 | 4071664 | 15 |
16 | Wauktug | 23.8217 | 20000000 | 16 |
17 | kalvotom | 24.5542 | 20000000 | 17 |
Relativní porovnání rychlosti běhu vzhledem k nejrychlejšímu řešení.
plt.grid()
bar(axes(data.randomize_periodic, 1), data.randomize_periodic, tick_label=data.username)
plt.xticks(rotation=80);
Odhad alokace paměti (v bytech).
plt.grid()
bar(axes(data.randomize_periodic_mem, 1), data.randomize_periodic_mem, tick_label=data.username)
plt.xticks(rotation=80);
A nyní pevné hraniční podmínky.
data[!, :randomize_fixed] /= minimum(data.randomize_fixed);
sort!(data, [:randomize_fixed]);
for k in axes(data, 1)
data[k, :score] += k
end
data[:, Cols(:username, :randomize_fixed, :randomize_fixed_mem, :score)]
Row | username | randomize_fixed | randomize_fixed_mem | score |
---|---|---|---|---|
String15 | Float64 | Int64 | Int64 | |
1 | Jogug | 1.0 | 0 | 2 |
2 | Saraugug | 1.36806 | 0 | 9 |
3 | Parfu | 1.9018 | 0 | 5 |
4 | Zuhgan | 2.01996 | 1984112 | 9 |
5 | Xunaakt | 2.0912 | 2000048 | 11 |
6 | Borkul | 2.6389 | 1984192 | 14 |
7 | Ugghra | 2.72907 | 248112 | 17 |
8 | Xig | 2.8122 | 1984256 | 20 |
9 | Shum | 2.82832 | 0 | 18 |
10 | Xomkug | 2.90222 | 1984192 | 14 |
11 | Quordud | 3.1056 | 0 | 22 |
12 | Gilaktug | 4.39364 | 1984192 | 25 |
13 | Bugharz | 5.08147 | 1984192 | 27 |
14 | Epkagut | 5.44322 | 4071664 | 29 |
15 | Saghig | 5.96255 | 1984112 | 18 |
16 | Wauktug | 28.3015 | 19840320 | 32 |
17 | kalvotom | 29.8243 | 19840320 | 34 |
Relativní porovnání rychlosti běhu vzhledem k nejrychlejšímu řešení.
plt.grid()
bar(axes(data.randomize_fixed, 1), data.randomize_fixed, tick_label=data.username)
plt.xticks(rotation=80);
Odhad alokace paměti (v bytech).
plt.grid()
bar(axes(data.randomize_fixed_mem, 1), data.randomize_fixed_mem, tick_label=data.username)
plt.xticks(rotation=80);
energy
Výpočet energie pomocí Nejprve model s periodickými hraničními podmínkami.
data[!, :energy_periodic] /= minimum(data.energy_periodic);
sort!(data, [:energy_periodic]);
for k in axes(data, 1)
data[k, :score] += k
end
data[:, Cols(:username, :energy_periodic, :energy_periodic_mem, :score)]
Row | username | energy_periodic | energy_periodic_mem | score |
---|---|---|---|---|
String15 | Float64 | Int64 | Int64 | |
1 | Xig | 1.0 | 2000048 | 21 |
2 | Zuhgan | 1.49407 | 0 | 11 |
3 | Saraugug | 1.64439 | 0 | 12 |
4 | Borkul | 2.51385 | 26002528 | 18 |
5 | Jogug | 2.70829 | 0 | 7 |
6 | Parfu | 2.81583 | 2000048 | 11 |
7 | Xomkug | 3.52484 | 30027120 | 21 |
8 | Xunaakt | 3.59408 | 0 | 19 |
9 | Quordud | 4.26073 | 0 | 31 |
10 | Bugharz | 5.27259 | 22450640 | 37 |
11 | Shum | 5.29694 | 0 | 29 |
12 | Wauktug | 7.98047 | 2000048 | 44 |
13 | Saghig | 16.9093 | 52000000 | 31 |
14 | kalvotom | 17.0842 | 0 | 48 |
15 | Ugghra | 27.7823 | 94038144 | 32 |
16 | Gilaktug | 363.809 | 1213843856 | 41 |
17 | Epkagut | 2729.23 | 1020157152 | 46 |
Relativní porovnání rychlosti běhu vzhledem k nejrychlejšímu řešení.
plt.grid()
bar(axes(data.energy_periodic, 1), data.energy_periodic, tick_label=data.username)
plt.xticks(rotation=80);
Odhad alokace paměti (v bytech).
plt.grid()
bar(axes(data.energy_periodic_mem, 1), data.energy_periodic_mem, tick_label=data.username)
plt.xticks(rotation=80);
A nyní pevné hraniční podmínky.
data[!, :energy_fixed] /= minimum(data.energy_fixed);
sort!(data, [:energy_fixed]);
for k in axes(data, 1)
data[k, :score] += k
end
data[:, Cols(:username, :energy_fixed, :energy_fixed_mem, :score)]
Row | username | energy_fixed | energy_fixed_mem | score |
---|---|---|---|---|
String15 | Float64 | Int64 | Int64 | |
1 | Saraugug | 1.0 | 0 | 13 |
2 | Jogug | 1.37081 | 0 | 9 |
3 | Xig | 2.56501 | 2000048 | 24 |
4 | Parfu | 3.78543 | 2000048 | 15 |
5 | Zuhgan | 3.98731 | 0 | 16 |
6 | Bugharz | 4.1832 | 10367808 | 43 |
7 | Borkul | 4.36564 | 25929392 | 25 |
8 | Xomkug | 4.6604 | 25929200 | 29 |
9 | kalvotom | 4.69981 | 0 | 57 |
10 | Xunaakt | 5.60723 | 0 | 29 |
11 | Shum | 7.04544 | 0 | 40 |
12 | Wauktug | 7.26116 | 2000048 | 56 |
13 | Quordud | 12.0252 | 2000048 | 44 |
14 | Saghig | 27.7426 | 52000000 | 45 |
15 | Ugghra | 45.447 | 80023024 | 47 |
16 | Gilaktug | 572.221 | 1212687248 | 57 |
17 | Epkagut | 5874.44 | 1018754336 | 63 |
Relativní porovnání rychlosti běhu vzhledem k nejrychlejšímu řešení.
plt.grid()
bar(axes(data.energy_fixed, 1), data.energy_fixed, tick_label=data.username)
plt.xticks(rotation=80);
Odhad alokace paměti (v bytech).
plt.grid()
bar(axes(data.energy_fixed_mem, 1), data.energy_fixed_mem, tick_label=data.username)
plt.xticks(rotation=80);
evolve!
Výpočet časového vývoje pomocí Nejprve model s periodickými hraničními podmínkami.
data[!, :evolution_periodic] /= minimum(data.evolution_periodic);
sort!(data, [:evolution_periodic]);
for k in axes(data, 1)
data[k, :score] += k
end
data[:, Cols(:username, :evolution_periodic, :evolution_periodic_mem, :score)]
Row | username | evolution_periodic | evolution_periodic_mem | score |
---|---|---|---|---|
String15 | Float64 | Float64 | Int64 | |
1 | Shum | 1.0 | 496.0 | 41 |
2 | Xunaakt | 1.79191 | 320000.0 | 31 |
3 | Borkul | 1.89899 | 0.0 | 28 |
4 | Zuhgan | 1.9292 | 0.0 | 20 |
5 | Bugharz | 2.48865 | 595520.0 | 48 |
6 | kalvotom | 3.41778 | 496.0 | 63 |
7 | Xomkug | 4.91722 | 8.04981e6 | 36 |
8 | Saraugug | 10.2732 | 0.0 | 21 |
9 | Jogug | 16.2662 | 0.0 | 18 |
10 | Parfu | 17.6632 | 2.00005e6 | 25 |
11 | Wauktug | 43.1369 | 0.0 | 67 |
12 | Saghig | 96.5048 | 5.24895e7 | 57 |
13 | Ugghra | 152.909 | 9.47793e7 | 60 |
14 | Xig | 10051.2 | 4.00018e9 | 38 |
15 | Epkagut | 28617.2 | 1.38795e9 | 78 |
16 | Quordud | 1.04013e5 | 4.0008e6 | 60 |
17 | Gilaktug | 1.77106e96 | 9.99e101 | 74 |
Relativní porovnání rychlosti běhu vzhledem k nejrychlejšímu řešení.
plt.grid()
bar(axes(data.evolution_periodic, 1), data.evolution_periodic, tick_label=data.username)
plt.xticks(rotation=80);
Odhad alokace paměti (v bytech).
plt.grid()
bar(axes(data.evolution_periodic_mem, 1), data.evolution_periodic_mem, tick_label=data.username)
plt.xticks(rotation=80);
A nyní pevné hraniční podmínky.
data[!, :evolution_fixed] /= minimum(data.evolution_fixed);
sort!(data, [:evolution_fixed]);
for k in axes(data, 1)
data[k, :score] += k
end
data[:, Cols(:username, :evolution_fixed, :evolution_fixed_mem, :score)]
Row | username | evolution_fixed | evolution_fixed_mem | score |
---|---|---|---|---|
String15 | Float64 | Float64 | Int64 | |
1 | Xunaakt | 1.0 | 0.0 | 32 |
2 | Shum | 1.15287 | 496.0 | 43 |
3 | Xomkug | 1.1922 | 0.0 | 39 |
4 | kalvotom | 2.28515 | 496.0 | 67 |
5 | Bugharz | 3.68754 | 575040.0 | 53 |
6 | Saraugug | 3.71886 | 0.0 | 27 |
7 | Borkul | 3.8653 | 479744.0 | 35 |
8 | Jogug | 7.30133 | 0.0 | 26 |
9 | Parfu | 20.4606 | 2.00005e6 | 34 |
10 | Wauktug | 61.6337 | 0.0 | 77 |
11 | Saghig | 135.842 | 5.24889e7 | 68 |
12 | Ugghra | 431.765 | 8.06234e7 | 72 |
13 | Xig | 14655.0 | 4.00018e9 | 51 |
14 | Epkagut | 26551.6 | 1.38575e9 | 92 |
15 | Quordud | 2.87412e5 | 1.17803e10 | 75 |
16 | Zuhgan | 2.41568e96 | 9.99e101 | 36 |
17 | Gilaktug | 2.41568e96 | 9.99e101 | 91 |
Relativní porovnání rychlosti běhu vzhledem k nejrychlejšímu řešení.
plt.grid()
bar(axes(data.evolution_fixed, 1), data.evolution_fixed, tick_label=data.username)
plt.xticks(rotation=80);
Odhad alokace paměti (v bytech).
plt.grid()
bar(axes(data.evolution_fixed_mem, 1), data.evolution_fixed_mem, tick_label=data.username)
plt.xticks(rotation=80);
Skóre (čím menší hodnota, tím lépe)
sort!(data, :score)
data[:, :points] = zeros(Int64, nrow(data))
n = 0
for k in axes(data, 1)
# kalvotom se nepočíta, zbývá 14 studentů
if data[k, :username] == "kalvotom"
continue
end
data[k, :points] = 5 - div(n, 4)
n += 1
end
data[:, Cols(:username, :score, :points)]
Row | username | score | points |
---|---|---|---|
String15 | Int64 | Int64 | |
1 | Jogug | 26 | 5 |
2 | Saraugug | 27 | 5 |
3 | Xunaakt | 32 | 5 |
4 | Parfu | 34 | 5 |
5 | Borkul | 35 | 4 |
6 | Zuhgan | 36 | 4 |
7 | Xomkug | 39 | 4 |
8 | Shum | 43 | 4 |
9 | Xig | 51 | 3 |
10 | Bugharz | 53 | 3 |
11 | kalvotom | 67 | 0 |
12 | Saghig | 68 | 3 |
13 | Ugghra | 72 | 3 |
14 | Quordud | 75 | 2 |
15 | Wauktug | 77 | 2 |
16 | Gilaktug | 91 | 2 |
17 | Epkagut | 92 | 2 |