Repository navigation
perf: split BrowserPanelView's modifier chain so it type-checks quickly - #13105
teamleaderleo wants to merge 1 commit into
Conversation
The chain of preference, notification, appear and onChange modifiers on BrowserPanelView's body was one expression that took about 7-8 s to type-check. Split it into three computed views applied in the same order. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesBrowser panel lifecycle composition
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Suggested reviewers: 🚥 Pre-merge checks | ✅ 25✅ Passed checks (25 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
|
Continued in #13130 (in-org branch). |
Summary
BrowserPanelView's body ended in one chain of 20 modifiers (coordinateSpace, threeonPreferenceChange, twoonReceive,onAppear/onDisappear, twelveonChange). The compiler type-checks that chain as a single expression, and it was the slowest expression in the app module.browserPanelLifecyclePreferencesView->browserPanelLifecycleNotificationsView-> theonChangegroup). The modifiers, their closures and their order are unchanged; nothing else in the file is touched.Testing
Measured on one machine (MacBook Air M5, Xcode 27.0) with
-Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200:Sources/Panels/BrowserPanelView.swift:1073)xcodebuild -scheme cmux -configuration Debug buildon this branch:BUILD SUCCEEDED.Sources/Surfaces/SurfaceCatalog+CloudPorts.swift:37(2.7 s).Demo Video
Not applicable: no behaviour change.
Checklist
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Splits
BrowserPanelView's single chain of 20 modifers into three computed views so the Swift compiler type-checks it in under 200 ms instead of ~7–8 s. Modifier order and closures are unchanged, so there is no behavior change.Benchmarks
Sources/Panels/BrowserPanelView.swiftdrops from 8,120 ms to under 200 ms.xcodebuild -scheme cmux -configuration Debug build; UI behavior not manually tested.Written for commit a5a8296. Summary will update on new commits.
Summary by CodeRabbit