Closed
Bug 1832863
Opened 3 years ago
Closed 3 years ago
Consider using methods that don't generate a new URI in the content process
Categories
(Firefox :: Search, task, P1)
Firefox
Search
Tracking
()
RESOLVED
FIXED
115 Branch
| Tracking | Status | |
|---|---|---|
| firefox115 | --- | fixed |
People
(Reporter: jteow, Assigned: jteow)
References
Details
Attachments
(1 file)
We have a couple places where we call .href or generate a new URI.
This can be costly.
I've saved a SERP on my local machine and triggered categorized 1000 times:
- https://share.firefox.dev/3nTyWYa - ~3.41 ms
- https://share.firefox.dev/3Mmcfp9 - ~3.47 ms
Compare to when I just get the attribute in getAttribute:
- https://share.firefox.dev/3VWF5zk - ~2.56 ms
- https://share.firefox.dev/41uCZIf - ~2.40 ms
The flamegraph shows inspecting the anchor is a pretty costly operation especially due to the generation of a URI anytime we retrieve an href.
Eventually in SearchSERPTelemetry, we'll need to get an absolute URL to match against, but we can look into being more thoughtful on being a bit more efficient. Ideas:
- Get the href once, and cache that somewhere.
- Later, if it's relative, manually make it absolute
- If there is a specific character to convert (i.e. the apostrophe), just using Services.io.newURI to convert everything
| Assignee | ||
Comment 1•3 years ago
•
|
||
If it's too hairy to cache the href, we could just manually construct an absolute href during times when we detect it's a relative URL.
| Assignee | ||
Comment 2•3 years ago
|
||
Updated•3 years ago
|
Assignee: nobody → jteow
Status: NEW → ASSIGNED
Pushed by jteow@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0b628d699ddc
Use getAttribute instead of href property - r=scunnane
Comment 4•3 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
status-firefox115:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•