JSWindowActorChild.sendAsyncMessage is a bottleneck when logging 1000 times in a loop
Categories
(Core :: DOM: Content Processes, task)
Tracking
()
People
(Reporter: nchevobbe, Unassigned)
References
(Blocks 1 open bug)
Details
Here's a profile for a talos test doing something similar to
for (let i = 0; i < 1000; i++) {
console.log(42);
}
https://share.firefox.dev/3wJx1aW
About 30% of the time is spend in sendAsyncMessage
, including ~10% spent cloning the data
For each console.log call, a message is sent via JSActor
The message has a shape similar to:
{
"type": "resource-available-form",
"resources": [
{
"resourceType": "console-message",
"message": {
"arguments": [
42
],
"chromeContext": false,
"columnNumber": 9,
"filename": "debugger eval code",
"level": "log",
"lineNumber": 1,
"timeStamp": 1648473803933,
"sourceId": "server0.conn1.windowGlobal6442450945/source47",
"category": "webdev",
"innerWindowID": 6442450945
}
}
],
"from": "server0.conn1.windowGlobal6442450945/windowGlobalTarget2"
}
We tried avoiding sending arrays where we could (see Bug 1760962), as well as limiting the number of properties in the packet which showed some improvements (~5% in the content process), at the cost of making the message shape a bit convoluted, which required re-computing some properties on the parent process (e.g. https://phabricator.services.mozilla.com/D142093)
With Bug 1753177, any improvement we can make in the content process is making the console faster since we're throttling resources on the parent process, so in the end, we would consume bigger "bulks" of messages, and render less often.
Looking at the profile, is there anything that could be done on the sendAsyncMessage
part to make it faster? (we're also looking at the devtools specific parts at the same time)
Thanks!
Comment 1•2 years ago
|
||
JSWindowActorChild
is implemented outside the JS engine, so moving to a different component.
Description
•