This is an archive of the discontinued Mercurial Phabricator instance.

rust-matchers: use the `regex` crate
ClosedPublic

Authored by Alphare on Mar 24 2020, 1:55 PM.

Details

Summary

Instead of falling back to Python when a code path with "ignore" functionality
is reached and Re2 is not installed, the default compilation (i.e. without
the with-re2 feature) will use the regex crate for all regular expressions
business.

As with the introduction of Re2 in a previous series, this yields a big
performance boost compared to the Python + C code in status, diff, commit,
update, and maybe others.

For now Re2 looks to be faster at compiling the DFA (1.5ms vs 5ms for
Netbeans' .hgignore) and a bit faster in actual use: (123ms vs 137ms for
the parallel traversal of Netbeans' clean repo). I am in talks with the author
of regex to see whether that performance difference is a bug, a "won't fix",
or a tuning issue.

The regex crate is already one of our dependencies and using this code does
not require any additional work from the end-user than to use the Rust
extensions.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Alphare created this revision.Mar 24 2020, 1:55 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.