mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-05 14:42:07 -07:00
regex: tweak DFA settings
This increases the limits a bit for when the regex engine will build and use a fully compiled DFA. They can faster in some circumstances. For example, '(?-u)^\w{30,}$' gets a nice speed boost from state acceleration. We are also able to remove `regex` proper as a dependency. Wow.
This commit is contained in:
@@ -233,6 +233,15 @@ impl ConfiguredHIR {
|
||||
let meta = Regex::config()
|
||||
.utf8_empty(false)
|
||||
.nfa_size_limit(Some(self.config.size_limit))
|
||||
// We don't expose a knob for this because the one-pass DFA is
|
||||
// usually not a perf bottleneck for ripgrep. But we give it some
|
||||
// extra room than the default.
|
||||
.onepass_size_limit(Some(10 * (1 << 20)))
|
||||
// Same deal here. The default limit for full DFAs is VERY small,
|
||||
// but with ripgrep we can afford to spend a bit more time on
|
||||
// building them I think.
|
||||
.dfa_size_limit(Some(10 * (1 << 20)))
|
||||
.dfa_state_limit(Some(10_000))
|
||||
.hybrid_cache_capacity(self.config.dfa_size_limit);
|
||||
Regex::builder()
|
||||
.configure(meta)
|
||||
|
Reference in New Issue
Block a user