perf(web): speed up diff file sorting - #10423
Conversation
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — This is a focused six-line optimization of existing diff-file sorting that reuses an equivalent collator configuration and does not introduce new user-facing behavior or broader system changes. Its runtime impact is limited to reducing sorting overhead in the existing DiffPanel path. Not approved because:
No code changes detected at Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more. |
3bf7b33 to
2bd1022
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesDiffPanel sorting
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to Diff file paths are now sorted with a reused collator to improve rendering performance while retaining existing ordering behavior. The change is ready to merge with no current-head merge-blocking risk identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice. Comment |
What Changed
DiffPanelrepeats locale setup while comparing file paths in a patch. Create anIntl.Collatoron the first comparison and reuse it for the rest of the sort, with the existing default locale, numeric ordering, and base sensitivity. This applies the folder-menu optimization from #10190 to the diff panel.Why
Sorting 500 tracked repository paths in Git order took 5.48 ms before and 0.11 ms after in a warmed Node 24.14.0 benchmark on Windows (median of 25 batches). This compares the actual memo bodies using synthetic patches; it measures sorting, excluding parsing and rendering.
Verification
diffRendering.test.tsanddiffFileTree.logic.test.ts: 14 tests passed.git diff --checkpassed. Targeted lint reports only two warnings reproduced on the original file.Checklist
No appearance or interaction changes.
Implemented with GPT-6 through Codex desktop.
Summary by CodeRabbit