Skip to content

Commit 0034a6e

Browse files
benching
1 parent cb10954 commit 0034a6e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

benches/mdx_benchmark.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion};
22
use mdx::parse;
33

44
pub fn criterion_benchmark(c: &mut Criterion) {
5-
c.bench_function("parse", |b| b.iter(|| parse(black_box("# Some"))));
5+
c.bench_function("parse", |b| {
6+
b.iter(|| {
7+
parse(black_box(
8+
"# Some
9+
10+
---
11+
12+
## Content",
13+
))
14+
})
15+
});
616
}
717

818
criterion_group!(benches, criterion_benchmark);

src/ast.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ fn mdx_elements_internal(input: &str) -> IResult<&str, Vec<MdxAst>, ErrorTree<&s
4040
}
4141

4242
fn mdx_ast(input: &str) -> IResult<&str, MdxAst, ErrorTree<&str>> {
43-
let (input, ast) = nom::branch::alt((ast_atx_heading, ast_thematic_break))(input)?;
44-
Ok((input, ast))
43+
nom::branch::alt((ast_atx_heading, ast_thematic_break))(input)
4544
}
4645

4746
/// We have to wrap the structs to fit in the MdxAst

0 commit comments

Comments
 (0)