Skip to content

why does adding regex-automata to Cargo.toml increase Regex::new compilation times? #1208

Answered by BurntSushi
vvmikheev asked this question in Q&A
Discussion options

You must be logged in to vote

It happens because regex and regex-automata do not have the same set of default features. regex-automata, in particular, has dfa-build and dfa-search enabled by default. But for regex, those features only get enabled when perf-dfa-full is enabled, and that's specifically not enabled by default for precisely the reason you've run into.

The perf-dfa-full feature causes regex to try and use a fully determinized DFA in some cases. It has pretty harsh limits on when it attempts this to avoid making regex compile times even worse, but even building a small DFA is expensive. However, it can open up new optimization opportunities, which is why it's a thing. But in general, the trade off isn't rea…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@vvmikheev
Comment options

@BurntSushi
Comment options

@BurntSushi
Comment options

@vvmikheev
Comment options

@BurntSushi
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1207 on June 24, 2024 12:46.