changeset 67:31905126f204

Attempt at better profiling execution
author Lewin Bormann <lbo@spheniscida.de>
date Sat, 31 Aug 2019 20:40:40 +0200
parents ae022a4c1234
children be9b8751f568
files Cargo.toml benches/profile.rs
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Cargo.toml	Sat Aug 31 20:40:24 2019 +0200
+++ b/Cargo.toml	Sat Aug 31 20:40:40 2019 +0200
@@ -12,3 +12,7 @@
 [[bench]]
 name = "e2e"
 harness = false
+
+[[bench]]
+name = "profile"
+harness = false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/benches/profile.rs	Sat Aug 31 20:40:40 2019 +0200
@@ -0,0 +1,15 @@
+
+fn bench_complicated() {
+    let re_s = "^[hH][eE]l+o +[Ww]orld!?$";
+    let re = rex::compile(re_s).unwrap();
+    let inputs = vec!["Hello World", "hEllo world!", "HEllllllo   world", "Helllllllllo      world!"];
+    let size = inputs.len();
+    println!("{}", rex::render_graph(re_s));
+    for i in 0..100_000 {
+        assert!(rex::match_re(&re, inputs[i%size]).0);
+    }
+}
+
+fn main() {
+    bench_complicated();
+}