Skip to content

Comments

regex perf improvements#317

Merged
ZhidongPeng merged 3 commits intoAzure:devfrom
ZhidongPeng:regex
Feb 18, 2026
Merged

regex perf improvements#317
ZhidongPeng merged 3 commits 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.

@ZhidongPeng ZhidongPeng enabled auto-merge (squash) February 18, 2026 19:11
@ZhidongPeng ZhidongPeng merged commit 75dd5d4 into Azure:dev Feb 18, 2026
12 checks passed
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