-
Notifications
You must be signed in to change notification settings - Fork 842
Optimize empty string pattern matching with null-safe length checks #19189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
15
commits into
main
Choose a base branch
from
copilot/optimize-empty-string-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
T-Gro
reviewed
Jan 5, 2026
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize F# pattern match for empty string equality
Optimize empty string pattern matching with null-safe length checks
Jan 5, 2026
vzarytovskii
reviewed
Jan 6, 2026
…ion in BuildSwitch only Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
…ompatibility Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
…, move release notes to 10.0.200 Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
…ontexts Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
…t null checks Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Member
|
/run ilverify |
Contributor
🔧 CLI Command Report
✅ Patch applied: |
T-Gro
approved these changes
Jan 14, 2026
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.
String Empty Pattern Match Optimization - Investigation Complete
Comprehensive investigation of redundant null check elimination completed. The
isNullFilteredparameter infrastructure is in place but not eliminating redundant checks as expected.Changes Made
Removed
hasIsNullEdgecomputation (line 821-823): Simplified the logic to only use theisNullFilteredparameter that's passed through recursive calls, rather than trying to detect IsNull edges in the current edges list.Debug instrumentation in place (lines 774-851): Comprehensive logging available via
verboseflag to trace pattern compilation flow.Current Behavior
The optimization IS working for the primary goal:
.Length == 0instead ofString.EqualsBut redundant null checks remain:
| null | "" -> 0generate two null checksRoot Cause Analysis
The
isNullFilteredparameter is set totrueat line 801 after processing an IsNull edge, and passed to recursive BuildSwitch calls at line 811. However, the IL shows the redundant check persists.Theory: The issue may be that the empty string check is being generated in a DIFFERENT BuildSwitch invocation than where
isNullFiltered=truewas set. The decision tree structure for OR patterns may not be what we expect.Next Steps
Need to understand the exact decision tree structure created for OR patterns. The verbose flag provides logging, but output isn't captured in test runs. May need to create a standalone compilation scenario to trace the exact flow.
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.