1 | use criterion::{black_box, criterion_group, Criterion}; |
---|---|
2 | |
3 | use anes::parser::Parser; |
4 | |
5 | pub fn parser(c: &mut Criterion) { |
6 | const XTERM_MOUSE: &str = "\x1B [<28;20;10;m"; |
7 | |
8 | let mut parser = Parser::default(); |
9 | |
10 | c.bench_function("advance and consume", |b| { |
11 | let input = XTERM_MOUSE.as_bytes(); |
12 | |
13 | b.iter(|| { |
14 | parser.advance(black_box(input), black_box(true)); |
15 | while let Some(_) = parser.next() {} |
16 | }) |
17 | }); |
18 | } |
19 | |
20 | criterion_group!(benches, parser); |
21 |