aboutsummaryrefslogtreecommitdiffstats
path: root/benches/bench.rs
blob: 5ba0e16d0b97467e931dd0374a041ac91e3c39da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#[macro_use]
extern crate criterion;
use criterion::{BenchmarkId, Criterion};
use std::fs;

fn readme(c: &mut Criterion) {
    let doc = fs::read_to_string("readme.md").unwrap();

    c.bench_with_input(BenchmarkId::new("readme", "readme"), &doc, |b, s| {
        b.iter(|| markdown::to_html(s));
    });
}

// fn one_and_a_half_mb(c: &mut Criterion) {
//     let doc = fs::read_to_string("../a-dump-of-markdown/markdown.md").unwrap();
//     let mut group = c.benchmark_group("giant");
//     group.sample_size(10);
//     group.bench_with_input(BenchmarkId::new("giant", "1.5 mb"), &doc, |b, s| {
//         b.iter(|| markdown::to_html(s));
//     });
//     group.finish();
// }
// , one_and_a_half_mb

criterion_group!(benches, readme);
criterion_main!(benches);