Repository navigation
perf(automations): reuse collation setup when sorting names - #18823
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Collator reuse in
sortAutomationListViewItems— replaces per-comparisonlocaleCompare(…, { sensitivity: 'base' })with a singlenew Intl.Collator(getIntlLocale(), { sensitivity: 'base' })constructed once per name sort; direction inversion, ID tie-break, and input immutability are unchanged. - New regression tests — a differential oracle reimplements the old comparator across en/sv/tr/ja and both directions, plus a count oracle proving one collator construction per sort and zero optioned
localeComparecalls, plus coverage for unsorted/time-sorted/trivial lists. - Benchmark extension — adds an automation arm calling the production sorter, enables jiti
jsx, and moves to six counterbalanced rounds with an even-sample median.
The change is semantically equivalent to the prior implementation: sensitivity: 'base' with default usage: 'sort' behaves identically between String.prototype.localeCompare and Intl.Collator, and extracting .compare is safe because Intl.Collator.prototype.compare returns a bound function. The items.length < 2 early return changes nothing observable (a ≤1-element list is already sorted). Tests are meaningful and can fail against a regression. No behavioral surface beyond the intended perf win.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe automation list sorter now returns copied results for unsorted and short lists. Name sorting uses Merge Risk: ⚪ Minimal · up to Automation name sorting now reuses locale-aware collation setup while preserving ordering, tie-breaks, and input behavior. The change is ready to merge with no current-head risk identified. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the implementation, motivation, benchmark results, testing, and linked issue context. However, it does not follow the required template and omits the required Visual Proof section or an explicit N/A explanation, testing checkboxes, AI Disclosure, Review, boundary confirmation, Notes, and Checklist. Resolution Update the description to include all template sections. Add visual proof or write exactly
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

Automation-name sorting resolved collation options for every comparison. Reuse one
Intl.Collatorper name sort, using the current UI locale each time. Preserve direction, ID tie-breaks, input row identities and input immutability; unsorted, time-sorted and trivial lists avoid collation setup.Found by the source audit in #18822. This PR is independently based on main. It extends the existing locale-sort benchmark to call the production automation sorter, enables JSX for its real import graph, and uses six counterbalanced rounds with an even-sample median.
Measured on macOS arm64 / Node 24.18.0 (milliseconds per sort):
The 1,000-row case is a scaling fixture, not a measured user inventory. These are sorter timings, not end-to-end UI latency. Both benchmark arms assert identical output; there is no hardware-dependent timing gate.
Validation: 16 tests across the existing list-view suite and six new regressions; the operation-count test fails on the original implementation. Differential checks cover English, Swedish, Turkish and Japanese, both directions and ties; the count oracle verifies one constructor per sort and zero optioned
localeComparecalls.pnpm tc:web, changed-code quality and formatting passed. Runnode config/scripts/locale-collator-sort-benchmark.mjsto reproduce. Sorting remains client-side for local and external automation rows; no wire, host-execution, Git-provider or workspace identity changes.