Closed
Bug 1812055
Opened 2 years ago
Closed 2 years ago
Add fast path for adding a plain object property or array element to structured clone reading
Categories
(Core :: JavaScript Engine, task, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
111 Branch
Tracking | Status | |
---|---|---|
firefox111 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 3 open bugs)
Details
(Whiteboard: [sp3])
Attachments
(1 file)
The DefineDataProperty
in JSStructuredCloneReader::readObjectField
is pretty slow, see the profile in bug 1811666. We can get rid of most of these calls with a fast path for plain object properties and dense array elements.
This improves the micro-benchmark below from ~1200 ms to ~930 ms.
function f() {
var arr = [];
for (var i = 0; i < 50; i++) {
arr.push(i, {x: 1});
}
var buf = serialize(arr);
var t = new Date;
var res;
for (var i = 0; i < 100_000; i++) {
res = deserialize(buf);
}
print(new Date - t);
return res;
}
f();
Assignee | ||
Comment 1•2 years ago
•
|
||
On typical workloads, these fast paths for plain objects and array objects handle
at least 97% of cases. This is much faster than the generic DefineDataProperty
code.
Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b9c4ba784620
Add fast paths for the most common cases to JSStructuredCloneReader::readObjectField. r=sfink
Comment 3•2 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
status-firefox111:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
Assignee | ||
Comment 4•2 years ago
|
||
Looking at the deserialize_us
telemetry probe, after this landed the 95% percentile improved consistently from 72 to 60 (-16.7%). The 50% percentile from 3 to 2 (-33%).
Updated•2 years ago
|
Whiteboard: [sp3]
Updated•2 years ago
|
See Also: → https://mozilla-hub.atlassian.net/browse/SP3-238
You need to log in
before you can comment on or make changes to this bug.
Description
•