Improve performance of common url name lookups
Categories
(Firefox :: Bookmarks & History, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox97 | --- | fixed |
People
(Reporter: bdahl, Assigned: bdahl)
Details
Attachments
(1 file)
Currently, we iterate over all possible matches and run a regex. This can be slow when run on many URLs.
Assignee | ||
Comment 1•3 years ago
|
||
Instead of matching URL hostnames with a regex in a loop, work backwards
from the end of the hostname and build a substring at each "."
separator in the hostname. Using the substring, lookup to see if there's a
common name match.
In the common case of <x>.<tld> this will complete in one map lookup.
For two part TLDs (e.g. "example.co.uk"), it will take two lookups.
Assignee | ||
Comment 2•3 years ago
|
||
Running the current tests in a loop 24k times:
Current | New |
---|---|
3.7437879999998813 | 3.4763289999999643 |
2633.073231 | 60.42609900000002 |
1.7031870000000708 | 1.6397720000001073 |
2821.003696 | 177.723479 |
2876.997405 | 63.73837200000003 |
2821.1009919999997 | 60.183937000000014 |
Assignee | ||
Comment 3•3 years ago
|
||
The numbers where performance didn't change are where we have metadata and we don't look up the custom name.
Assignee | ||
Comment 4•3 years ago
|
||
For potential future work:
As far as I can tell, creating the JS URL is now the expensive part. There's also still a slow path for getting the domain name part. The TLD stripping part is expensive according to comments in the method.
Comment 6•3 years ago
|
||
bugherder |
Description
•