On the Speedometer 3 "NewsSite" subtests, HTMLImageElement spends too much time creating URLs
Categories
(Core :: DOM: Core & HTML, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox117 | --- | fixed |
People
(Reporter: mstange, Assigned: emilio)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Attachments
(2 files)
On the Speedometer3 subtest "NewsSite-Next", one of our biggest buckets for improvement is the time under Node.appendChild
. This function spends most of its time creating nsIURI
objects under HTMLImageElement::LoadSelectedImage
.
Eliminating the performance difference in Node.appendChild
should improve our score on this subtest by 1.7%.
You can run this test at https://shell--speedometer-preview.netlify.app/?suite=NewsSite-Next&iterationCount=1 .
Profiles:
Firefox: https://share.firefox.dev/3OkdCp4 (634 samples)
Chrome: https://share.firefox.dev/44LYYfM (176 samples, 3.6x faster)
The image URL is placeholder_light.jpg
.
I think what's happening is that the actual load gets kicked off from setAttribute("src", "...")
. Creating a URL there is fine. But then, when we add the node to the document, we end up in HTMLImageElement::BindToTree
, which adds a script runner for HTMLImageElement::MaybeLoadImage
(with aAlwaysLoad == false
).
This results in a call to HTMLImageElement::LoadSelectedImage
, which creates a new URI, notices that it matches the currently loaded source, and bails out.
Can we avoid creating URI objects in this case?
Updated•2 years ago
|
Reporter | ||
Comment 1•2 years ago
|
||
This issue also affects "NewsSite-Nuxt" ("u" instead of "e"), which would be improved by 2.7% if this were fixed.
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 2•2 years ago
|
||
Boris, is this something you could look into? (I noticed you looked at similar code in bug 1789475)
Comment 3•2 years ago
|
||
I'm not sure if it is possible to check if it matches the current source if we don't create the URI. For responsive image, we still have to select the correct image, so it may be pretty hard to skip the selection.
For creating URI object, I'm not sure if there are any other ways to simplify the check the matchness. Emilio, do you have any idea to avoid creating URI objects to improve this?
Assignee | ||
Comment 4•2 years ago
|
||
I mean, in theory we can cache the parsed src
attribute right? It probably makes sense.
Assignee | ||
Comment 5•2 years ago
|
||
Updated•2 years ago
|
Assignee | ||
Comment 6•2 years ago
|
||
Depends on D184265
Assignee | ||
Updated•2 years ago
|
Comment 8•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Comment 10•2 years ago
|
||
bugherder |
Description
•