Skip to content
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

Refactor FXIOS-9353 #20714 Improving BVC viewDidLoad #24487

Merged
merged 6 commits into from
Feb 4, 2025

Conversation

lmarceau
Copy link
Contributor

📜 Tickets

Jira ticket
Github issue

💡 Description

I started profiling the start up of the app, and this is a first attempt at improving the BVC load time since it has a big impact. This is a little step since we gotta start somewhere, and small incremental changes in that area makes more sense to ensure there's no breakage. My intent there is to move some things off the main thread when we first load BVC. I noticed:

  • We were creating an unused UISearchController under the AppStartUpTelemetry, this had impact on launch time (see screenshot).
    UISearchController
  • I moved the app start up telemetry off the main thread with a delay, since some of those telemetry are accessing RustLogins which seems to be unneeded on the main thread when we're trying to load the app.
  • Non UI tasks where also moved on a background thread.
  • updateToolbarStateForTraitCollection was removed from the viewDidLoad since it's also present in viewWillAppear, so that seems like a duplicate call not needed.

📝 Checklist

You have to check all boxes before merging

  • Filled in the above information (tickets numbers and description of your work)
  • Updated the PR name to follow our PR naming guidelines
  • Wrote unit tests and/or ensured the tests suite is passing
  • When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • If needed, I updated documentation / comments for complex code and public methods
  • If needed, added a backport comment (example @Mergifyio backport release/v120)

@lmarceau lmarceau requested a review from a team as a code owner January 31, 2025 17:26
@FilippoZazzeroni FilippoZazzeroni self-requested a review February 3, 2025 09:59
Copy link
Collaborator

@mattreaganmozilla mattreaganmozilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't had a chance to exercise this branch thoroughly but the changes look Ok to me 👍 , my only minor concern is that offloading some of this might introduce hard-to-replicate edge cases. Might be a good idea to get a 2nd reviewer sign-off, but otherwise lgtm :shipit:

+ fix some stuff that needs to be on the main thread
Move telemetry in the telemetry tracking class
- Move Search bar telemetry to the trackStartUpTelemetry function
- Move updateCreditCardAutofillStatus into main.async
- Remove commented code
- Move setupNotifications back to setupEssentialUI since we dont want race conditions
@lmarceau lmarceau force-pushed the lm/FXIOS-9353-#20714-BVC-load branch from 40f776b to 1a33cf9 Compare February 4, 2025 16:56
@lmarceau
Copy link
Contributor Author

lmarceau commented Feb 4, 2025

Okkk. I made some updates and removed the non essential UI function (using a DispatchQueue.main.async since it didn't seem to have any positive impact after re-profiling. I also change to use a Task(priority:) instead of a DispatchQueue as suggested.

The only offloading is related to telemetry now. Impact should be minimal. Load time is slightly improved by 15 ms with this PR 🤷‍♀️ I'll take that, better than nothing!

@lmarceau lmarceau merged commit ac020c0 into main Feb 4, 2025
10 checks passed
@lmarceau lmarceau deleted the lm/FXIOS-9353-#20714-BVC-load branch February 4, 2025 17:29
aya-en-amir pushed a commit to aya-en-amir/firefox-ios that referenced this pull request Feb 5, 2025
…ozilla-mobile#24487)

* Try to improve viewDidLoad

* Remove UISearchController init from startpath, wasn't even needed

+ fix some stuff that needs to be on the main thread

* Remove redundant call to updateToolbarStateForTraitCollection

Move telemetry in the telemetry tracking class

* Update

- Move Search bar telemetry to the trackStartUpTelemetry function
- Move updateCreditCardAutofillStatus into main.async
- Remove commented code
- Move setupNotifications back to setupEssentialUI since we dont want race conditions

* Create setupNonEssentialUI function

* Remove non essential UI + change to Task(priority:) for background telemetry queue
@FilippoZazzeroni
Copy link
Collaborator

That is good @lmarceau it is still an improvement 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants