[Repo Assist] perf: pre-compile redaction and UI regexes (CommandCenterTextHelper, WizardPage, SchemaConfigEditor, QuickSendDialog)#286
Draft
github-actions[bot] wants to merge 2 commits intomasterfrom
Conversation
Replace 11 on-demand Regex.Replace/Match calls (in CommandCenterTextHelper, WizardPage, SchemaConfigEditor, and QuickSendDialog) with static readonly pre-compiled Regex fields using RegexOptions.Compiled. Each field is compiled once at startup and reused on every invocation, eliminating the overhead of per-call regex compilation or .NET cache lookups. Affected call sites: - CommandCenterTextHelper.RedactSupportPath: 2 patterns - CommandCenterTextHelper.RedactSupportValue: 6 patterns - WizardPage.Render: 2 patterns (URL detection + device code) - SchemaConfigEditor.GetLabel: 1 pattern (camelCase → label) - QuickSendDialog.TryExtractMissingScope: 1 pattern No behaviour change; all 393 Tray tests and 1219 Shared tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
19 tasks
Leave QuickSendDialog to the dedicated titlebar/focus PR so this Repo Assist perf change can remain independent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Eleven
Regex.Replace/Regex.Matchcalls across four files were invoking the .NET regex engine from a literal pattern string on every call — either recompiling or fetching from the small static cache. This PR replaces them withprivate static readonly Regexfields compiled once at startup usingRegexOptions.Compiled.Files changed
CommandCenterTextHelper.csWizardPage.csSchemaConfigEditor.xaml.csQuickSendDialog.csNo functional change
Pattern strings, replacement strings, and
RegexOptionsflags are unchanged. Match timeouts that were passed toRegex.Replace(..., TimeSpan)are now in theRegexconstructor, which has identical effect — the timeout applies per match call either way.Test Status
dotnet test OpenClaw.Tray.Tests→ 392 passed, 1 skipped (same as baseline; skipped test is Windows-only DPAPI)dotnet test OpenClaw.Shared.Tests→ 1219 passed, 1 pre-existing failure, 20 skipped (unchanged)build.ps1requires Windows and was not run in this Linux CI environment; no Windows-specific code was changed