Domain autocomplete provider uses inefficient linear search algorithm, excess power usage?
Categories
(Firefox for Android :: Toolbar, task)
Tracking
()
People
(Reporter: csadilek, Unassigned)
Details
From github: https://github.com/mozilla-mobile/android-components/issues/11638.
afaict, for each character typed, we execute autocomplete. We have two autocomplete providers: history and domains. For each character, the domain provider iterates over all of its domains:
iiuc, the US has ~500 domains – the US list has 49 and the
globallist has 444 lines. That's about 1000startsWithcalls per character typed, which seems excessive.If we used a more efficient algorithm, we could save CPU and power. We haven't noticed any unreasonable delays (though it's not instantaneous on the Moto G5) so this is primarily about power. My naive solution would be to sort the domain list and do binary search (note that binarySearch is built in), getting it down to O(log n). Perhaps we can do better. Ideally, we'd measure the power difference because it's possible additional operations required to binary search are less efficient than linear traversal.
We could also consider adding a brief delay after each character typed before we start autocomplete so that we don't autocomplete if a user is just going to type over the result anyway.
We should double-check the places/history provider to make sure it's also efficient.
┆Issue is synchronized with this Jira Task
Change performed by the Move to Bugzilla add-on.
Comment 1•3 years ago
|
||
The severity field is not set for this bug.
:cpeterson, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Updated•2 years ago
|
Description
•