Closed
Bug 1405123
Opened 7 years ago
Closed 7 years ago
Only create the outer wrapper object in JSON.stringify when necessary
Categories
(Core :: JavaScript: Standard Library, enhancement)
Core
JavaScript: Standard Library
Tracking
()
RESOLVED
FIXED
mozilla58
Tracking | Status | |
---|---|---|
firefox58 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(1 file)
2.49 KB,
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
When JSON.stringify is called with an object which contains only a few properties, the overhead of creating the initial wrapper object is noticeable.
Assignee | ||
Comment 1•7 years ago
|
||
This gives a performance improvement when the to be stringified object has only a few properties. For example this µ-benchmark improves from 1.5s to 1.1s: var o = Array(10).fill("hello"); var t = dateNow(); for (var i = 0; i < 1000000; ++i) { JSON.stringify(o); } print(dateNow() - t);
Attachment #8914670 -
Flags: review?(jdemooij)
Comment 2•7 years ago
|
||
Comment on attachment 8914670 [details] [diff] [review] bug1405123.patch Review of attachment 8914670 [details] [diff] [review]: ----------------------------------------------------------------- This is really great, thanks.
Attachment #8914670 -
Flags: review?(jdemooij) → review+
Assignee | ||
Comment 3•7 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=b7a5a3ae76417013a8150dddbc20628d694254bd
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/67b836888700 Only create the initial holder when JSON.stringify was called with a replacer function. r=jandem
Keywords: checkin-needed
Comment 5•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/67b836888700
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in
before you can comment on or make changes to this bug.
Description
•