Open Bug 1795448 Opened 3 years ago Updated 1 year ago

`SuggestionFetcher` creates 7 threads – can we re-use existing threads?

Categories

(Firefox for Android :: Toolbar, task)

All
Android
task

Tracking

()

People

(Reporter: csadilek, Unassigned)

Details

From github: https://github.com/mozilla-mobile/android-components/issues/11177.

The search SuggestionFetcher creates a new ExecutorService with a thread for each provider:

https://github.com/mozilla-mobile/android-components/blob/4223f401756848b61ca39be8f6fd461bd4c97fc9/components/compose/awesomebar/src/main/java/mozilla/components/compose/browser/awesomebar/internal/SuggestionFetcher.kt#L27-L30

In the current implementation, there appear to be 7 providers – https://share.firefox.dev/3E4PbEk – so we're creating 7 threads. (fwiw, the old provider used 3). Given these threads will be largely idle and some of these providers don't do IO, this seems excessive: are there other threads we can re-use to conserve resources? For example, could we use the IO dispatcher? Given the only thing on this screen is searching, it seems unlikely that that dispatcher will be at capacity. Also, there's a thread pool for the top sites icons that's likely inactive now – can we share those threads?

That being said, I'm not sure what and how many resources idle ExecutorService threads take up. Do they use CPU? How much memory do they use? How does sharing (or not sharing) threads affect cache locality?

┆Issue is synchronized with this Jira Task

Change performed by the Move to Bugzilla add-on.

The severity field is not set for this bug.
:cpeterson, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(cpeterson)
Severity: -- → N/A
Type: defect → task
Flags: needinfo?(cpeterson)
You need to log in before you can comment on or make changes to this bug.