summaryrefslogtreecommitdiffstats
path: root/vendor/regex-syntax/benches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/regex-syntax/benches
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/regex-syntax/benches')
-rw-r--r--vendor/regex-syntax/benches/bench.rs63
1 files changed, 63 insertions, 0 deletions
diff --git a/vendor/regex-syntax/benches/bench.rs b/vendor/regex-syntax/benches/bench.rs
new file mode 100644
index 000000000..d4703d4fc
--- /dev/null
+++ b/vendor/regex-syntax/benches/bench.rs
@@ -0,0 +1,63 @@
+#![feature(test)]
+
+extern crate test;
+
+use regex_syntax::Parser;
+use test::Bencher;
+
+#[bench]
+fn parse_simple1(b: &mut Bencher) {
+ b.iter(|| {
+ let re = r"^bc(d|e)*$";
+ Parser::new().parse(re).unwrap()
+ });
+}
+
+#[bench]
+fn parse_simple2(b: &mut Bencher) {
+ b.iter(|| {
+ let re = r"'[a-zA-Z_][a-zA-Z0-9_]*(')\b";
+ Parser::new().parse(re).unwrap()
+ });
+}
+
+#[bench]
+fn parse_small1(b: &mut Bencher) {
+ b.iter(|| {
+ let re = r"\p{L}|\p{N}|\s|.|\d";
+ Parser::new().parse(re).unwrap()
+ });
+}
+
+#[bench]
+fn parse_medium1(b: &mut Bencher) {
+ b.iter(|| {
+ let re = r"\pL\p{Greek}\p{Hiragana}\p{Alphabetic}\p{Hebrew}\p{Arabic}";
+ Parser::new().parse(re).unwrap()
+ });
+}
+
+#[bench]
+fn parse_medium2(b: &mut Bencher) {
+ b.iter(|| {
+ let re = r"\s\S\w\W\d\D";
+ Parser::new().parse(re).unwrap()
+ });
+}
+
+#[bench]
+fn parse_medium3(b: &mut Bencher) {
+ b.iter(|| {
+ let re =
+ r"\p{age:3.2}\p{hira}\p{scx:hira}\p{alphabetic}\p{sc:Greek}\pL";
+ Parser::new().parse(re).unwrap()
+ });
+}
+
+#[bench]
+fn parse_huge(b: &mut Bencher) {
+ b.iter(|| {
+ let re = r"\p{L}{100}";
+ Parser::new().parse(re).unwrap()
+ });
+}