Closed Bug 1958756 Opened 3 months ago Closed 2 months ago

Testcase inserting N @import stylesheets spends a lot of time on the parent-process.

Categories

(Core :: Networking, defect, P2)

defect
Points:
3

Tracking

()

VERIFIED FIXED
139 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox137 --- wontfix
firefox138 --- wontfix
firefox139 --- fixed

People

(Reporter: mayankleoboy1, Assigned: jdescottes)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [webdriver:m16][necko-triaged])

Attachments

(4 files)

N=10K
Firefox: https://share.firefox.dev/421qRlx (1.2s)
Chrome: https://share.firefox.dev/4cqS8Bw (600ms)

N=50K
Firefox: https://share.firefox.dev/3G98Yso (6s)
Chrome: https://share.firefox.dev/3R3ruov (3s)

N=100K
Firefox: https://share.firefox.dev/4jlSfk7 (15s)
Firefox Samply: https://share.firefox.dev/4loUuoI
Chrome: https://share.firefox.dev/4jlSjjR (6s)

We spend a large time on the parent-process. Overhead of taskcontrollers or something, or is it just errors ?

Flags: needinfo?(emilio)

So the parent process time seems to be due to data: channel notifying the parent process and so on. DataChannelParent::NotifyListeners.

Do you know what that is about Randell? I'd expect data: uris to do little to no work in the parent process given no networking should really be necessary? DataChannelParent seems like it was introduced to support redirect-to-data: uris but there's nothing like that going on here?

Flags: needinfo?(emilio) → needinfo?(rjesup)

@valentin Do you know anything about DataChannelParent?

Flags: needinfo?(rjesup) → needinfo?(valentin.gosu)

So DataChannelParent was only supposed to be used for redirects but in bug 1903060 we changed this to allow data channels to be displayed in devtools. This made the IPC connection be created for each DataChannelChild, which seems problematic indeed.
We might want to revert that and rethink the implementation.

Flags: needinfo?(valentin.gosu)
Component: CSS Parsing and Computation → Networking
Keywords: regression
Regressed by: 1903060

Set release status flags based on info from the regressing bug 1903060

:jdescottes, since you are the author of the regressor, bug 1903060, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(jdescottes)

As said in https://bugzilla.mozilla.org/show_bug.cgi?id=1903060#c2, we can monitor the observer notification in content processes if needed. It will require some work to adapt DevTools and more so WebDriver BiDi. Or we make the IPC optional and only do it if the BrowsingContext is watchedByDevTools, or if a remote protocol is started (we don't really have a BC flag for BiDi)

I don't think this has anything to do with import + stylesheets, it's probably just related to the data URIs used in the test case.

We must have the same issue with File URLs, I think we use the same pattern.

Valentin, can you or someone from Necko set the priority here?

Flags: needinfo?(jdescottes) → needinfo?(valentin.gosu)

I think data URLs are used quite frequently in CSS, and we don't want to perf regress them.
file URLs are not as common on the web I presume, though we might want them to have the same behaviour.
I'll back out 1903060 in that case, and we can try monitoring the notification in the content process.

Assignee: nobody → valentin.gosu
Severity: -- → S3
Flags: needinfo?(valentin.gosu)
Priority: -- → P2
Whiteboard: [necko-triaged]

Julien, do you mind backing out the patches?
They there are some conflicts in the WPTs, otherwise I would have done it myself.
Thanks!

Assignee: valentin.gosu → jdescottes
Flags: needinfo?(jdescottes)

(In reply to Valentin Gosu [:valentin] (he/him) from comment #7)

I think data URLs are used quite frequently in CSS, and we don't want to perf regress them.
file URLs are not as common on the web I presume, though we might want them to have the same behaviour.
I'll back out 1903060 in that case, and we can try monitoring the notification in the content process.

I don't think we can simply backout the patch, as it will break both DevTools and BiDi tests. We also need to update both implementations to start reading the notifications from the content process. So I can take the bug, but I will need time to update both...

Flags: needinfo?(jdescottes)
Status: NEW → ASSIGNED

We should avoid doing unnecessary IPC when the data channel can fully be
handled in content processes. DevTools and WebDriver BiDi can monitor the corresponding
observer notifications in content processes.

Depends on D246572

See initial patch in the stack. Sending parent process notifications for
all data channels had a non-negligeable performance impact.
The necko changes are backed out and DevTools should now monitor the observer
notification both in parent and content processes.

Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/03903beed57c Back out patches for exposing data channel notifications in parent r=valentin,necko-reviewers https://hg.mozilla.org/integration/autoland/rev/58d591d8f43c [bidi] Monitor data channels in windowglobal network module r=webdriver-reviewers,Sasha https://hg.mozilla.org/integration/autoland/rev/95ff39756993 [devtools] Monitor data channels in network-events-content actor r=devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch

This should now be available in Nightlies on all platforms. Not sure how the initial benchmark was run, but maybe you can give it another try now?

Flags: needinfo?(mayankleoboy1)

Profile with latest Nightly (which i think should have the fix from this bug). N=10000
https://share.firefox.dev/42Ss6CT

Flags: needinfo?(mayankleoboy1) → needinfo?(jdescottes)

Looks like it's still an old nightly, buildid is from yesterday 20250424205049
Maybe we should check tomorrow. Correct binary should be at https://archive.mozilla.org/pub/firefox/nightly/2025/04/2025-04-25-09-15-26-mozilla-central/

But I did record profiles on my machine and I can see the parent process is no longer busy.
However I'm not sure what you were timing exactly?

Flags: needinfo?(jdescottes)
Flags: needinfo?(mayankleoboy1)

Samply profile with latest Nightly: https://share.firefox.dev/42NDMH4 (12s)
Chrome: https://share.firefox.dev/42SHHT3 (7s)
The time in parent-process is all gone now. I will close this bug as fixed and open a new bug for the relative slowness.

Status: RESOLVED → VERIFIED
Flags: needinfo?(mayankleoboy1)
Summary: Testcase inserting N @import stylesheets is 2x slower in Firefox, and spends a lot of time on the parent-process. → Testcase inserting N @import stylesheets spends a lot of time on the parent-process.
See Also: → 1962846
Points: --- → 3
Whiteboard: [necko-triaged] → [webdriver:m16][necko-triaged]
Regressions: 1963576
QA Whiteboard: [qa-triage-done-c140/b139]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: