changeset 44779:b15a37d85dbe stable

rust-regex: increase the DFA size limit for the `regex` crate `re2`'s DFA limit is already increased in `rust/hg-core/src/re2/rust_re2.cpp`, the same has to be done for the `regex` crate. Big repositories with big `.hgignore`s will sometimes hit this limit and face extreme performance regressions (I've seen one take *minutes* for `hg status`). Differential Revision: https://phab.mercurial-scm.org/D8499
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 07 May 2020 10:15:19 +0200
parents ee0790b67c45
children f727939f3513
files rust/hg-core/src/matchers.rs
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/matchers.rs	Fri May 01 21:47:39 2020 +0530
+++ b/rust/hg-core/src/matchers.rs	Thu May 07 10:15:19 2020 +0200
@@ -358,6 +358,10 @@
     let pattern_string = unsafe { String::from_utf8_unchecked(escaped_bytes) };
     let re = regex::bytes::RegexBuilder::new(&pattern_string)
         .unicode(false)
+        // Big repos with big `.hgignore` will hit the default limit and
+        // incur a significant performance hit. One repo's `hg status` hit
+        // multiple *minutes*.
+        .dfa_size_limit(50 * (1 << 20))
         .build()
         .map_err(|e| PatternError::UnsupportedSyntax(e.to_string()))?;