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 | |
parent | e943d7c88fe0e0b8a8d799ceec3439c16c5150f2 (diff) |
add benchmark for tokens patterns
-rw-r--r-- | Cargo.lock | 12 | ||||
-rw-r--r-- | Cargo.toml | 9 | ||||
-rw-r--r-- | benches/toks.rs | 27 |
3 files changed, 39 insertions, 9 deletions
@@ -117,9 +117,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bet" -version = "0.4.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5edd00b661a92a0db2263a455ee2c9ae80942dbc804401bbb5a4598c4968af2e" +checksum = "3e218e587658fb0b595e7d27c222a4caf56748a47644bc31483973d8dc6d8670" [[package]] name = "bincode" @@ -774,9 +774,9 @@ dependencies = [ [[package]] name = "lazy-regex" -version = "0.1.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a32b42cf4770f191a2899a4b565d124d888d3f7fdbdd30ad98cf2c1d2b470f" +checksum = "7d4358d81ee87faee9eab26098e3efde0a72ed8db1c7d40fa3ec1d9f68fcf283" dependencies = [ "lazy_static", ] @@ -1428,9 +1428,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "secular" -version = "0.3.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd0cba6d9810b4cbb984d54e8c0aa16f9c3f57011baba57cb2cc5c6f3011648" +checksum = "a4c9ad4c423ca634baf90edd056c562dc7730215e0689aa5eaf707f92f219905" dependencies = [ "unicode-normalization", ] @@ -22,7 +22,7 @@ clipboard = ["terminal-clipboard"] ahash = { version = "0.7", features = ["serde"] } ansi_colours = "1.0" base64 = "0.13" -bet = "0.4.0" +bet = "1.0" char_reader = "0.1" clap = { version="2.33", default-features=false, features=["suggestions", "color"] } cli-log = "1.1" @@ -38,7 +38,7 @@ git2 = { version="0.13", default-features=false } glob = "0.3" id-arena = "2.2.1" image = "0.23.14" -lazy-regex = "0.1.3" +lazy-regex = "1.0" lazy_static = "1.4" libc = "0.2" log = "0.4" @@ -49,7 +49,7 @@ pathdiff = "0.2" phf = { version = "0.8", features = ["macros"] } rayon = "1.5" regex = "1.4" -secular = { version = "0.3", features = ["normalization"] } +secular = { version = "1.0", features = ["normalization"] } serde = { version = "1.0", features = ["derive"] } smallvec = "1.6" splitty = "0.1" @@ -87,6 +87,9 @@ codegen-units = 1 # this removes a few hundred bytes from the final exec size name = "fuzzy" harness = false [[bench]] +name = "toks" +harness = false +[[bench]] name = "composite" harness = false [[bench]] 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, +); |