MCPcopy Create free account
hub / github.com/davidblewett/rure-python / should_suffix_scan

Method should_suffix_scan

regex/src/exec.rs:1277–1283  ·  view source on GitHub ↗

Returns true if the program is amenable to suffix scanning. When this is true, as a heuristic, we assume it is OK to quickly scan for suffix literals and then do a *reverse* DFA match from any matches produced by the literal scan. (And then followed by a forward DFA search, since the previously found suffix literal maybe not actually be the end of a match.) This is a bit of a specialized optimiz

(&self)

Source from the content-addressed store, hash-verified

1275 /// strings are generally rarer, so we only enable this optimization when
1276 /// we have a meaty suffix.
1277 fn should_suffix_scan(&self) -> bool {
1278 if self.suffixes.is_empty() {
1279 return false;
1280 }
1281 let lcs_len = self.suffixes.lcs().char_len();
1282 lcs_len >= 3 && lcs_len > self.dfa.prefixes.lcp().char_len()
1283 }
1284}
1285
1286#[derive(Clone, Copy, Debug)]

Callers 1

choose_match_typeMethod · 0.80

Calls 4

char_lenMethod · 0.80
lcsMethod · 0.80
lcpMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected