summary refs log tree commit diff
path: root/bonusaufgabe/src/benchmark.rs
blob: 9063977c8288c8e0c46b378768e67d62125c93d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use super::*;
use test::Bencher;

fn benchmark(task_file_name: &str, bencher: &mut Bencher) {
    let task_str = fs::read_to_string(task_file_name).expect("Datei kann nicht gelesen werden");
    let task = Task::try_from(task_str.as_str()).expect("Datei enthält keine gültige Aufgabe");

    bencher.iter(|| solve_task(&task));
}

#[bench]
fn benchmark3(bencher: &mut Bencher) {
    benchmark("input/stapel3.txt", bencher);
}

#[bench]
fn benchmark4(bencher: &mut Bencher) {
    benchmark("input/stapel4.txt", bencher);
}

#[bench]
fn benchmark5(bencher: &mut Bencher) {
    benchmark("input/stapel5.txt", bencher);
}