Skip to content

regex perf improvements#317

Open
ZhidongPeng wants to merge 1 commit intoAzure:devfrom
ZhidongPeng:regex
Open

regex perf improvements#317
ZhidongPeng wants to merge 1 commit intoAzure:devfrom
ZhidongPeng:regex

Conversation

@ZhidongPeng
Copy link
Collaborator

  • Regex::New is performance-sensitive - use LazyLock to compile it only once as a static regex and reuse it for subsequent calls
  • search_files should not create a new regex instance each time, and the caller should cache the regex if it is used frequently.
  • Config setting value get_xxx in Config invoked resolve_env_variables at each call - resolve all the config values at new when first read & parse our config file.
  • regex.replace_all's time-complexity is O(m * n^2) in redact_secrets - first check for indicators, just simple substrings to check for before running the more expensive regexes.

}

pub fn get_log_folder(&self) -> String {
match misc_helpers::resolve_env_variables(&self.logFolder) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we remove match? misc_helpers::resolve_env_variables doesn't contain match, it returns prev val

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants