-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix FXiOS-12300 [Tab Optimization] Only persist tab data after tabs have been removed #29911
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
base: main
Are you sure you want to change the base?
Conversation
| for (index, tab) in currentModeTabs.enumerated() { | ||
| self.removeTab(tab, flushToDisk: false) | ||
| if tab == currentModeTabs.last { | ||
| self.updateSelectedTabAfterRemovalOf(tab, deletedIndex: index) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Cramsden I haven't had a chance to take a close look, is this effectively the same basic approach as #26782? FYI I saw a weird index-related crash when testing my optimization, which I was concerned about. It was intermittent though and I still haven't had time to verify whether it was related to the optimization changes.
|
FYI just in case, there's a contributor PR opened for that same area of the code. |
018d354 to
eda3116
Compare
💪 Quality guardian1 tests files modified. You're a champion of test coverage! 🚀 🧹 Tidy commitJust 2 file(s) touched. Thanks for keeping it clean and review-friendly! 💬 Description craftsmanGreat PR description! Reviewers salute you 🫡 ✅ Per-file coverageAll changed files meet the threshold of 35.0%. Client.app: Coverage: 37.24
Generated by 🚫 Danger Swift against eda3116 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it out on iPhone and iPad, it's so much quicker!! 🙏
| for tab in currentModeTabs { | ||
| self.removeTab(tab.tabUUID) | ||
| // Remove each tab without persisting changes | ||
| self.removeTab(tab, flushToDisk: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if we should do similar improvements to removeNormalTabsOlderThan, since that was written similarly to the removeAllTabs method. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmarceau yes probably. i am tempted to do that as a follow up pr if you don't think that is too crazy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes follow up works perfectly
|
Hi @mattreaganmozilla I went with this solution because I personally did not think it was necessary to change the api for remove tab. Here I just kept the API for remove tab the same and modified removeAllTabs instead to use the internal remove tab functionality. It is inline with the feedback I gave on your original PR. Let me know if you would like me to change anything! |
📜 Tickets
Jira ticket
Github issue
Jira ticket
Github issue
💡 Description
Clean up remove tab logic so we are only doing the necessary tab persistence. Everywhere in the tab manager code we are persisting data more times than we need to. We should not need to re-select the tab and persist tab session data for each tab we remove.
This update:
There is no need to commit changes after this because select tab preserves tabs
With 200 tabs this greatly increases the tab performance.
TabManager.removeAllTabsBefore: 5.15 s 37.7%
After: 41.00 ms 3.4%
🎥 Demos
Demo
📝 Checklist