• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use test::Bencher;
2 
3 use crate::{Regex, Text};
4 
5 // USAGE: dna!(name, pattern, count)
6 //
7 // This is same as bench_find, except it always uses the regexdna haystack.
8 macro_rules! dna {
9     ($name:ident, $pattern:expr, $count:expr) => {
10         bench_find!(
11             $name,
12             $pattern,
13             $count,
14             include_str!("data/regexdna.txt").to_owned()
15         );
16     };
17 }
18 
19 dna!(find_new_lines, r">[^\n]*\n|\n", 83337);
20 dna!(variant1, r"agggtaaa|tttaccct", 32);
21 dna!(variant2, r"[cgt]gggtaaa|tttaccc[acg]", 115);
22 dna!(variant3, r"a[act]ggtaaa|tttacc[agt]t", 368);
23 dna!(variant4, r"ag[act]gtaaa|tttac[agt]ct", 254);
24 dna!(variant5, r"agg[act]taaa|ttta[agt]cct", 466);
25 dna!(variant6, r"aggg[acg]aaa|ttt[cgt]ccct", 135);
26 dna!(variant7, r"agggt[cgt]aa|tt[acg]accct", 137);
27 dna!(variant8, r"agggta[cgt]a|t[acg]taccct", 139);
28 dna!(variant9, r"agggtaa[cgt]|[acg]ttaccct", 197);
29 dna!(subst1, r"B", 29963);
30 dna!(subst2, r"D", 29987);
31 dna!(subst3, r"H", 30004);
32 dna!(subst4, r"K", 29974);
33 dna!(subst5, r"M", 29979);
34 dna!(subst6, r"N", 29959);
35 dna!(subst7, r"R", 30012);
36 dna!(subst8, r"S", 29994);
37 dna!(subst9, r"V", 29996);
38 dna!(subst10, r"W", 29984);
39 dna!(subst11, r"Y", 29947);
40