summaryrefslogtreecommitdiffstats
path: root/vendor/anes/benches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/anes/benches
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/anes/benches')
-rw-r--r--vendor/anes/benches/bench_main.rs5
-rw-r--r--vendor/anes/benches/benchmarks/mod.rs1
-rw-r--r--vendor/anes/benches/benchmarks/parser.rs20
3 files changed, 26 insertions, 0 deletions
diff --git a/vendor/anes/benches/bench_main.rs b/vendor/anes/benches/bench_main.rs
new file mode 100644
index 000000000..79aea4a76
--- /dev/null
+++ b/vendor/anes/benches/bench_main.rs
@@ -0,0 +1,5 @@
+use criterion::criterion_main;
+
+mod benchmarks;
+
+criterion_main!(benchmarks::parser::benches);
diff --git a/vendor/anes/benches/benchmarks/mod.rs b/vendor/anes/benches/benchmarks/mod.rs
new file mode 100644
index 000000000..67c567fa0
--- /dev/null
+++ b/vendor/anes/benches/benchmarks/mod.rs
@@ -0,0 +1 @@
+pub mod parser;
diff --git a/vendor/anes/benches/benchmarks/parser.rs b/vendor/anes/benches/benchmarks/parser.rs
new file mode 100644
index 000000000..2aa63aaa7
--- /dev/null
+++ b/vendor/anes/benches/benchmarks/parser.rs
@@ -0,0 +1,20 @@
+use criterion::{black_box, criterion_group, Criterion};
+
+use anes::parser::Parser;
+
+pub fn parser(c: &mut Criterion) {
+ const XTERM_MOUSE: &str = "\x1B[<28;20;10;m";
+
+ let mut parser = Parser::default();
+
+ c.bench_function("advance and consume", |b| {
+ let input = XTERM_MOUSE.as_bytes();
+
+ b.iter(|| {
+ parser.advance(black_box(input), black_box(true));
+ while let Some(_) = parser.next() {}
+ })
+ });
+}
+
+criterion_group!(benches, parser);