Open Bug 1509228 Opened 6 years ago Updated 2 years ago

Optimizing nsGlobalWindowOuter::NotifyContentBlockingState() seems to have an impact on pageload

Categories

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

enhancement

Tracking

()

Performance Impact medium

People

(Reporter: ehsan.akhgari, Unassigned)

References

Details

(Keywords: perf, perf:pageload)

Bug 1508944 shows how optimizing this function can have an impact on pageload, at least according to tp5.  This also makes sense depending on a few profiles that I looked at from talos in that bug, since this function is on the path of APIs like the document.cookie getter which are quite commonly accessed on web pages.

The majority of the cost comes from <https://searchfox.org/mozilla-central/rev/8f89901f2d69d9783f946a7458a6d7ee70635a94/dom/base/nsGlobalWindowOuter.cpp#5396> which goes to <https://searchfox.org/mozilla-central/rev/8f89901f2d69d9783f946a7458a6d7ee70635a94/toolkit/modules/WebProgressChild.jsm#191>.  There, in the talos profiles _setupJSON() was where most of the time was being spent but I didn't look much closer, may require further investigation.
Priority: -- → P3
Whiteboard: [qf] → [qf:investigate]
Flags: needinfo?(bugs)
See Also: → 1510275
One thing at least, we really must not run chrome JS even in mildly hot code paths.
So the options in such case are to call the code less often or write the code in C++, or both.
(In reply to Olli Pettay [:smaug] (high review load) from comment #2)
> So the options in such case are to call the code less often or write the
> code in C++, or both.

I'd say both!  :-)

The other thing that I noticed in the profiles of bug 1510275 which I haven't dug deeply into is the parent process side of things...  It seemed like once we get to the parent process things are quite bad there also.  For example _fixSecInfo seemed to take ~20% of time(!) <https://searchfox.org/mozilla-central/rev/f2028b4c38bff2a50ed6aa1763f6dc5ee62b0cc4/toolkit/modules/RemoteWebProgress.jsm#122>.  It'd be nice if you can have a deeper look Olli if you have cycles.
Flags: needinfo?(bugs)
Whiteboard: [qf:investigate] → [qf:p2:pageload]
Component: DOM → DOM: Core & HTML

is the function being renamed to something else? Looks like it doesn't exist anymore.

Performance Impact: --- → P2
Keywords: perf:pageload
Whiteboard: [qf:p2:pageload]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.