馃 perf: Match Tolerant Edit Lines Without Rebuilding Windows - #16562
Merged
Merged
Conversation
Contributor
Author
|
Review head: |
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.
Pull Request
Summary
Large multiline
edit_filemisses in skill authoring or code-execution files synchronously rebuild, normalize, and join an overlapping line window at every candidate position. This can block the API event loop. The matcher was introduced in #13435 and remains in #16520.Normalize trimmed lines once and match their integer IDs with KMP. Bound the final indentation fallback using the preceding strategies, without changing exact-match precedence, ambiguity detection, overlapping ranges, match limits, or offsets into the original UTF-16 content.
Related to #13435 and #16520.
How it works
After whitespace-normalized misses, an indentation match cannot contain two nonblank lines: such a match would already match at least two whitespace-separated tokens. All-blank matches are already handled by line-trimmed. For the remaining single-nonblank-line case, prefix counts reject windows containing other nonblank lines before comparing their suffixes. Each file line belongs to at most two eligible windows, preserving window-local indentation and residual whitespace without repeated normalization of overlapping windows.
Type of change
Testing
Tested environments/configuration: Node 24.16.0 in the attached Linux workspace. The original reported 18.6 seconds is not independently reproduced.
Automated tests:
trimEndcalls, once per file/needle line, rather than once per candidate window.origin/dev.Screenshots / recordings
No user-facing UI change.
Risk / compatibility
No configuration, authorization, storage, or public API changes. The whitespace-normalized regular-expression strategy is unchanged. The optimized indentation path relies on remaining last in the existing strategy order.
Checklist