Benchmark
This commit is contained in:
+227
@@ -0,0 +1,227 @@
|
|||||||
|
Iterx72,Nestingx72,Time µs
|
||||||
|
14,14,21945
|
||||||
|
2,0,625
|
||||||
|
13,3,1177
|
||||||
|
0,13,581
|
||||||
|
13,13,1134
|
||||||
|
12,6,1266
|
||||||
|
0,14,530
|
||||||
|
8,11,1003
|
||||||
|
12,1,1147
|
||||||
|
8,10,1060
|
||||||
|
14,12,1142
|
||||||
|
6,12,1136
|
||||||
|
10,6,1057
|
||||||
|
13,1,1182
|
||||||
|
8,13,1230
|
||||||
|
3,6,1165
|
||||||
|
11,4,17474
|
||||||
|
6,11,1050
|
||||||
|
7,5,1155
|
||||||
|
11,11,1322
|
||||||
|
12,7,1094
|
||||||
|
12,8,1045
|
||||||
|
10,11,1079
|
||||||
|
5,8,1142
|
||||||
|
2,1,1038
|
||||||
|
3,0,638
|
||||||
|
1,9,1027
|
||||||
|
0,11,522
|
||||||
|
4,13,1049
|
||||||
|
3,9,1079
|
||||||
|
11,5,1111
|
||||||
|
1,12,1037
|
||||||
|
9,7,1106
|
||||||
|
4,11,1172
|
||||||
|
2,9,1226
|
||||||
|
8,3,1124
|
||||||
|
8,7,1123
|
||||||
|
4,0,744
|
||||||
|
10,10,1146
|
||||||
|
10,2,1184
|
||||||
|
7,2,1813
|
||||||
|
10,13,1113
|
||||||
|
14,9,1925
|
||||||
|
2,14,3131
|
||||||
|
9,11,1112
|
||||||
|
11,9,1069
|
||||||
|
1,14,1137
|
||||||
|
5,13,1097
|
||||||
|
4,6,3971
|
||||||
|
14,6,1603
|
||||||
|
7,0,1663
|
||||||
|
3,12,1205
|
||||||
|
10,12,1083
|
||||||
|
0,0,1429
|
||||||
|
0,4,687
|
||||||
|
4,2,1504
|
||||||
|
3,13,1190
|
||||||
|
7,3,1402
|
||||||
|
6,14,1047
|
||||||
|
2,2,1133
|
||||||
|
4,12,1099
|
||||||
|
10,3,3732
|
||||||
|
6,10,1193
|
||||||
|
4,14,1457
|
||||||
|
5,12,1716
|
||||||
|
3,1,1130
|
||||||
|
13,12,1157
|
||||||
|
6,13,1201
|
||||||
|
6,5,1693
|
||||||
|
12,10,1045
|
||||||
|
7,10,2915
|
||||||
|
14,8,1831
|
||||||
|
3,2,1142
|
||||||
|
9,9,7308
|
||||||
|
7,7,6848
|
||||||
|
12,12,1053
|
||||||
|
8,14,1144
|
||||||
|
10,5,1117
|
||||||
|
11,13,1056
|
||||||
|
0,9,524
|
||||||
|
7,4,1888
|
||||||
|
7,13,1136
|
||||||
|
0,10,522
|
||||||
|
12,4,2243
|
||||||
|
0,3,812
|
||||||
|
2,6,1721
|
||||||
|
0,1,1237
|
||||||
|
6,4,1187
|
||||||
|
1,3,559
|
||||||
|
11,0,1186
|
||||||
|
1,8,1068
|
||||||
|
2,11,1147
|
||||||
|
11,1,1006
|
||||||
|
7,12,1183
|
||||||
|
12,13,1214
|
||||||
|
2,3,1149
|
||||||
|
8,4,1135
|
||||||
|
9,2,1030
|
||||||
|
13,4,858
|
||||||
|
3,8,1163
|
||||||
|
13,0,1392
|
||||||
|
4,3,1170
|
||||||
|
8,2,2436
|
||||||
|
5,10,3718
|
||||||
|
13,5,3525
|
||||||
|
5,0,1120
|
||||||
|
5,11,4088
|
||||||
|
10,8,1205
|
||||||
|
4,10,1032
|
||||||
|
10,4,1072
|
||||||
|
6,7,1394
|
||||||
|
3,5,3701
|
||||||
|
12,11,1012
|
||||||
|
7,6,1110
|
||||||
|
11,10,2031
|
||||||
|
14,4,1088
|
||||||
|
13,2,2757
|
||||||
|
7,9,1647
|
||||||
|
11,2,1225
|
||||||
|
9,0,1117
|
||||||
|
14,0,1063
|
||||||
|
4,1,1204
|
||||||
|
12,2,1098
|
||||||
|
0,7,599
|
||||||
|
3,3,1366
|
||||||
|
14,5,1161
|
||||||
|
10,14,1130
|
||||||
|
4,4,1057
|
||||||
|
9,3,1085
|
||||||
|
6,1,1092
|
||||||
|
11,7,1168
|
||||||
|
13,9,1214
|
||||||
|
14,3,889
|
||||||
|
2,8,1329
|
||||||
|
9,6,1104
|
||||||
|
14,7,2015
|
||||||
|
9,10,1102
|
||||||
|
2,13,1177
|
||||||
|
4,5,2013
|
||||||
|
2,5,1099
|
||||||
|
1,7,1083
|
||||||
|
1,1,812
|
||||||
|
1,13,892
|
||||||
|
7,11,1310
|
||||||
|
6,6,5371
|
||||||
|
8,8,1164
|
||||||
|
3,7,2720
|
||||||
|
14,11,1263
|
||||||
|
14,14,1111
|
||||||
|
5,9,1105
|
||||||
|
1,5,982
|
||||||
|
10,1,3444
|
||||||
|
12,5,1016
|
||||||
|
2,10,1120
|
||||||
|
9,1,1865
|
||||||
|
4,7,4106
|
||||||
|
1,0,648
|
||||||
|
3,4,1566
|
||||||
|
5,3,1112
|
||||||
|
11,8,951
|
||||||
|
2,4,1134
|
||||||
|
3,10,1430
|
||||||
|
6,0,727
|
||||||
|
7,14,1216
|
||||||
|
13,14,1940
|
||||||
|
9,12,1322
|
||||||
|
6,2,1115
|
||||||
|
9,4,1129
|
||||||
|
4,9,4591
|
||||||
|
2,7,1120
|
||||||
|
3,14,2022
|
||||||
|
6,3,1107
|
||||||
|
14,13,1028
|
||||||
|
6,8,6169
|
||||||
|
7,8,1256
|
||||||
|
12,3,1042
|
||||||
|
8,1,1500
|
||||||
|
6,9,1069
|
||||||
|
12,14,1044
|
||||||
|
13,7,21445
|
||||||
|
10,7,1166
|
||||||
|
0,2,808
|
||||||
|
12,9,1067
|
||||||
|
8,12,1182
|
||||||
|
13,10,1615
|
||||||
|
1,6,1091
|
||||||
|
9,8,1183
|
||||||
|
8,6,1090
|
||||||
|
10,9,1130
|
||||||
|
5,2,1382
|
||||||
|
12,0,1302
|
||||||
|
1,11,984
|
||||||
|
10,0,1070
|
||||||
|
1,4,1162
|
||||||
|
7,1,1454
|
||||||
|
8,9,1125
|
||||||
|
4,8,3043
|
||||||
|
14,1,1119
|
||||||
|
5,4,1077
|
||||||
|
5,14,1345
|
||||||
|
11,14,1040
|
||||||
|
0,6,604
|
||||||
|
9,13,2238
|
||||||
|
13,8,1379
|
||||||
|
11,6,1041
|
||||||
|
11,3,5384
|
||||||
|
3,11,1130
|
||||||
|
9,14,859
|
||||||
|
0,12,525
|
||||||
|
14,2,1527
|
||||||
|
8,0,1137
|
||||||
|
14,10,6363
|
||||||
|
0,5,686
|
||||||
|
11,12,1118
|
||||||
|
5,6,3832
|
||||||
|
5,7,1065
|
||||||
|
5,1,1082
|
||||||
|
1,10,990
|
||||||
|
0,8,609
|
||||||
|
1,2,1036
|
||||||
|
9,5,1046
|
||||||
|
13,6,3712
|
||||||
|
13,11,1184
|
||||||
|
2,12,1164
|
||||||
|
5,5,3398
|
||||||
|
8,5,1119
|
||||||
|
+39
-28
@@ -1,54 +1,65 @@
|
|||||||
use osui::prelude::*;
|
use osui::prelude::*;
|
||||||
|
|
||||||
use std::{sync::mpsc, thread};
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let engine = Arc::new(Benchmark::new(Console::new()));
|
let engine = Arc::new(Benchmark::new(Console::new()));
|
||||||
|
|
||||||
let (tx, rx) = mpsc::channel();
|
let mut benchmark_result: HashMap<(usize, usize), BenchmarkResult> = HashMap::new();
|
||||||
|
|
||||||
let max_threads = 32;
|
for i in 0..15 {
|
||||||
let mut handles = vec![];
|
for n in 0..15 {
|
||||||
|
let res = {
|
||||||
|
let mut results = Vec::with_capacity(6);
|
||||||
|
|
||||||
for chunk in (0..500).collect::<Vec<_>>().chunks(max_threads) {
|
for _ in 0..6 {
|
||||||
for &items in chunk {
|
results.push(
|
||||||
let engine = engine.clone();
|
engine
|
||||||
let tx = tx.clone();
|
.run(App {
|
||||||
|
n: n * 72,
|
||||||
let handle = thread::spawn(move || {
|
i: i * 72,
|
||||||
let res = engine
|
})
|
||||||
.run(BenchmarkApp { items })
|
.expect("Failed to run engine"),
|
||||||
.expect("Failed to run engine");
|
);
|
||||||
|
|
||||||
tx.send((items, res)).expect("Failed to send result");
|
|
||||||
});
|
|
||||||
|
|
||||||
handles.push(handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for handle in handles.drain(..) {
|
results.sort_by_key(|r| r.total_render);
|
||||||
handle.join().expect("Thread panicked");
|
results[3].clone()
|
||||||
|
};
|
||||||
|
|
||||||
|
benchmark_result.insert((i, n as usize), res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(tx);
|
let max = benchmark_result
|
||||||
|
.values()
|
||||||
|
.map(|b| b.total_render)
|
||||||
|
.max()
|
||||||
|
.unwrap_or(0);
|
||||||
|
|
||||||
let mut results: Vec<(usize, BenchmarkResult)> = rx.iter().collect();
|
println!("Iterx72,Nestingx72,Time µs\n14,14,{}", { max + 500 });
|
||||||
results.sort_by_key(|(items, _)| *items);
|
|
||||||
|
|
||||||
for (items, bench) in results {
|
for ((i, n), bench) in benchmark_result.iter() {
|
||||||
println!("Results for {items} items:\n{bench}");
|
println!("{i},{n},{}", bench.total_render);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn BenchmarkApp(cx: &Arc<Context>, items: &usize) -> View {
|
fn App(cx: &Arc<Context>, n: usize, i: usize) -> View {
|
||||||
let items = items.clone();
|
let n = n.clone();
|
||||||
|
let i = i.clone();
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
rsx! {
|
rsx! {
|
||||||
for _ in (0..items) {
|
|
||||||
"Hello, world!"
|
"Hello, world!"
|
||||||
}
|
}
|
||||||
|
.view(&cx)
|
||||||
|
} else {
|
||||||
|
rsx! {
|
||||||
|
for _ in (0..i) {
|
||||||
|
App { n: n - 1, i: 0 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.view(&cx)
|
.view(&cx)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user