Skip to content

Commit 08826e9

Browse files
committed
Update example benchmark to be more useful to others
1 parent 7065a5e commit 08826e9

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

tests/bench_dmi_load.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,41 @@ use std::fs::File;
44
use std::path::Path;
55
use std::time::Instant;
66
7+
const ICONS_FOLDER: &'static str = "UPDATEME";
8+
79
#[test]
810
fn bench_dmi_load() {
9-
println!("Icon::load_meta bench");
11+
let icons_folder_path = Path::new(ICONS_FOLDER);
12+
13+
println!("Icon::load_meta bench\n---");
1014
1115
let mut num_calls = 0;
1216
let mut microsec_calls = 0;
13-
for _ in 0..10 {
14-
recurse_process(Path::new("C:\\Users\\itsmeow\\Desktop\\Development\\SS13\\tgstation\\icons"), &mut num_calls, &mut microsec_calls, false);
17+
for _ in 0..25 {
18+
recurse_process(
19+
icons_folder_path,
20+
&mut num_calls,
21+
&mut microsec_calls,
22+
false,
23+
);
1524
}
1625
println!("Num calls: {num_calls}");
1726
println!("Total Call Duration (μs): {microsec_calls}");
1827
let mtpc = microsec_calls / num_calls as u128;
1928
println!("MTPC (μs): {mtpc}");
2029
21-
println!("Icon::load bench");
30+
println!("Icon::load bench\n---");
2231
2332
num_calls = 0;
2433
microsec_calls = 0;
25-
for _ in 0..10 {
26-
recurse_process(Path::new("C:\\Users\\itsmeow\\Desktop\\Development\\SS13\\tgstation\\icons"), &mut num_calls, &mut microsec_calls, false);
34+
// this is seriously slow. 2 iterations max or you'll be waiting all day
35+
for _ in 0..1 {
36+
recurse_process(
37+
icons_folder_path,
38+
&mut num_calls,
39+
&mut microsec_calls,
40+
false,
41+
);
2742
}
2843
println!("Num calls: {num_calls}");
2944
println!("Total Call Duration (μs): {microsec_calls}");

0 commit comments

Comments
 (0)