summaryrefslogtreecommitdiffstats
path: root/benches/md_parsing.rs
blob: eae99885ec9495cd4404738ab789330e9e083e64 (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
25
26
27
28
29
30
31
32
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use so::tui::markdown::parse;

const MD: &str = r####"
## project

Here's some `inline code`. It should escape `*asterisks*`.
It should also respect

    indented code blocks

and
```python
code fences
```
Obviously.

### but also
I'm on a Mac running OS X v10.6 (Snow Leopard). I have Mercurial 1.1 installed.

After I hit **[Esc]** to exit insert mode I can't figure out how to save and quit. Hitting **[Ctrl]** + **[C]** shows me instructions that say typing "quit<enter>" will write and quit, but it doesn't seem to work.


"####;

// TODO bench preprocess as well, separately
pub fn md_benchmark(c: &mut Criterion) {
    c.bench_function("markdown::parse", |b| b.iter(|| parse(black_box(MD))));
}

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