[Bug] publicSuffixList.prefetch() should not block
Currently we believe this method is reducing perf during startup: we should mitigate it.
Acceptance Criteria
- See if this is reducing perf during startup. If not, deprioritize this issue
- Refactor
PublicSuffixListso thatprefetch()is not blocking (consider wrapping inasync { })
cc @csadilek @jonalmeida
See #4420
┆Issue is synchronized with this Jira Task
Some notes from an offline conversation:
Some concerns with moving the prefetch to run async, was that we may fire an async prefetch at startup, and entering a search term in the search bar would trigger another prefetch for the isUrl check.
What we can try, is to put a LazyThreadSafetyMode.SYNCHRONIZED on the PublicSuffixListData class to ensure we only have sync access on the lazy data list.
Alternatively, a Executors.newSingleThreadExecutor() may work, but I'm unsure if access through kotlin is still sequential or any other overhead.
Some notes from an offline conversation:
Some concerns with moving the prefetch to run async, was that we may fire an async prefetch at startup, and entering a search term in the search bar would trigger another prefetch for the
isUrlcheck.What we can try, is to put a LazyThreadSafetyMode.SYNCHRONIZED on the PublicSuffixListData class to ensure we only have sync access on the lazy data list.
Alternatively, a
Executors.newSingleThreadExecutor()may work, but I'm unsure if access through kotlin is still sequential or any other overhead.
@jonalmeida Is there some follow up or action you need from the Performance team on this issue or is this is something that will be addressed on the Fenix engineering side?
@jonalmeida Is there some follow up or action you need from the Performance team on this issue or is this is something that will be addressed on the Fenix engineering side?
@hawkinsw mentioned that he wanted to look into the performance gains that would come making the prefetch async so I added the relevant labels on to the issue (maybe I got them wrong?).
The recommendations are from a conversation we were having while unblocking the Fenix team.
publicSuffixList.prefetch() accounts for 0.19% of onCreate() for the Home Activity (1.43 ms), so it does not seem like an immediate concern
Closing: we're addressing startup holistically and this doesn't appear to be a big concern.