fenix icon indicating copy to clipboard operation
fenix copied to clipboard

[Bug] publicSuffixList.prefetch() should not block

Open hawkinsw opened this issue 7 years ago • 5 comments

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 PublicSuffixList so that prefetch() is not blocking (consider wrapping in async { })

cc @csadilek @jonalmeida

See #4420

┆Issue is synchronized with this Jira Task

hawkinsw avatar Jul 31 '19 23:07 hawkinsw

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.

jonalmeida avatar Aug 16 '19 14:08 jonalmeida

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.

@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?

jeanygong avatar Sep 10 '19 21:09 jeanygong

@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.

jonalmeida avatar Sep 11 '19 15:09 jonalmeida

publicSuffixList.prefetch() accounts for 0.19% of onCreate() for the Home Activity (1.43 ms), so it does not seem like an immediate concern

emalysz avatar Dec 13 '19 22:12 emalysz

Closing: we're addressing startup holistically and this doesn't appear to be a big concern.

mcomella avatar Aug 03 '20 18:08 mcomella