aboutsummaryrefslogblamecommitdiffstats
path: root/benches/bench.rs
blob: 2d0875efb210b8a58f744d50379747ad49ace16c (plain) (tree)



























                                                                                  
#[macro_use]
extern crate criterion;
use criterion::{BenchmarkId, Criterion};
use micromark::micromark;
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(|| micromark(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(|| micromark(s));
//     });
//     group.finish();
// }

// one_and_a_half_mb

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