Closed Bug 1944819 Opened 1 year ago Closed 6 months ago

Firefox is 2x slower on artificial "Self-referencing Shadow DOM" testcase

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
147 Branch
Tracking Status
firefox147 --- fixed

People

(Reporter: mayankleoboy1, Assigned: smaug)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Open the attached testcase

enter 1000 and press enter

chrome: https://share.firefox.dev/4jDxfq0 (13s)
Nightly: https://share.firefox.dev/3WGviix (24s)

Testcase generated by chatgpt on my prompt. No idea how realistic this testcase is. But i hope that this may potentially highlight some hotspots.
As usual, feel free to mark INVALID/WONTFIX

Sean, any thoughts on the profile and if it highlights anything worth optimizing?

Flags: needinfo?(sefeng)
See Also: → 1943230

Nothing really stands out to me. I see we did a bunch of DOM works with calling appendChild, I am not sure how we can optimize anything in the call chain.

Olli, do you see anything?

Flags: needinfo?(sefeng) → needinfo?(smaug)

1000 elements
Profile with latest Nightly: https://share.firefox.dev/4kF4M3J (24s)

This is what I get today: https://share.firefox.dev/4i7S2AT (19.5s + CC) , which is very different and faster than the previous profile. No idea what changed in the interim period.

Blocks: 1980560
See Also: 1943230

latest profile: https://share.firefox.dev/47mauTk (22s + cleanup)

and this is with adding idlecallback in each iteration: https://share.firefox.dev/3Ln0wbI (70 seconds)

We have a flag which can be used here to improve this quite a bit, assuming I read the test and profile correctly.
(testing...)

Assignee: nobody → smaug
Status: NEW → ASSIGNED

The patch helps ~25%.
There might be still other things to optimize

Flags: needinfo?(smaug)
Pushed by opettay@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/fea6941decfb https://hg.mozilla.org/integration/autoland/rev/326156160cc8 no need to check if parent is a descendant of a new child, if new child doesn't have possible containers as its children, r=emilio
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch

Latest: https://share.firefox.dev/49NbfGz / https://share.firefox.dev/3LvMipa (17s + 5.5s in cleanup)
Olli, anything else that seems worth fixing?

Flags: needinfo?(smaug)

Other things would happen in other bugs. We might figure out some optimization for nsIMutationObserver. And clean up part is being handled elsewhere (possibly no specific bugs quite yet).

Flags: needinfo?(smaug)
See Also: → 2000355
QA Whiteboard: [qa-triage-done-c148/b147]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: