diff options
author | Canop <cano.petrole@gmail.com> | 2021-05-05 10:33:17 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-05-05 10:33:17 +0200 |
commit | 5080673dcc6bae5a671aa412f12053a016f44896 (patch) | |
tree | 823274546a935aa44b8dd1aa8cd8ada5cec390fe /benches | |
parent | e943d7c88fe0e0b8a8d799ceec3439c16c5150f2 (diff) |
add benchmark for tokens patterns
Diffstat (limited to 'benches')
-rw-r--r-- | benches/toks.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/benches/toks.rs b/benches/toks.rs new file mode 100644 index 0000000..fa05888 --- /dev/null +++ b/benches/toks.rs @@ -0,0 +1,27 @@ +mod shared; + +use { + broot::pattern::TokPattern, + glassbench::*, +}; + +static PATTERNS: &[&str] = &["", "a", "br,o,c", "e,jenc,arec,ehro", "broot"]; + +fn bench_score_of_toks(gb: &mut Bench) { + for pattern in PATTERNS { + let task_name = format!("TokPattern({:?})::score_of", pattern); + gb.task(task_name, |b| { + let fp = TokPattern::new(pattern); + b.iter(|| { + for name in shared::NAMES { + pretend_used(fp.score_of(name)); + } + }); + }); + } +} + +glassbench!( + "Tokens Patterns", + bench_score_of_toks, +); |