Remove redundant range checks in Uri scheme parsing#124284
Conversation
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
There was a problem hiding this comment.
Pull request overview
This PR removes redundant bounds checks in Uri scheme parsing now that the JIT can elide dependent range checks correctly (per #121262), reducing unnecessary overhead in a hot parsing path.
Changes:
- Simplified the early validation condition in
ParseSchemeCheckImplicitFileby removing now-redundant(uint)i/(uint)(i + 1)range checks.
🤖 Copilot Code Review — PR #124284Holistic AssessmentMotivation: ✅ The PR is justified. PR #124242 (merged today) improved the JIT to recognize that Approach: ✅ Correct approach. The remaining condition Summary: ✅ LGTM. Simple, correct cleanup that removes dead code following a JIT optimization. The change is a net positive — it removes unnecessary overhead and improves code clarity. Detailed Findings✅ Correctness — Bounds checks remain validVerified that after the simplified guard at line 3555-3556, all subsequent accesses are safe:
The check ✅ JIT Fix Verification — Dependency mergedConfirmed that PR #124242 ("Remove bounds checks for 'i + cns < len' pattern") was merged at 2026-02-11T16:18:03Z, which is the prerequisite for this cleanup. 💡 Minor — Comment could be removedThe comment |
Now that #121262 is fixed, these are no longer needed (and are in fact just overhead)