Closed Bug 1963431 Opened 22 days ago Closed 21 days ago

Add JS_StringifyWithLengthHint

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox140 --- fixed

People

(Reporter: iain, Assigned: iain)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

To save tab state, we periodically serialize a state object in the parent process (using JSON.stringify) to send it to another thread, where it is written to disk. For particularly large states, stringifying the state object takes a long time, and much of that time is spent reallocating the vector underlying the StringBuilder.

There are lots of things that can be changed here (and probably should), but a quick and dirty way to speed things up is to allow the code calling JS_Stringify to pass a length hint, and use it to preallocate a buffer of the right size.

Pushed by iireland@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/63538dac54ab Add JS_StringifyWithLengthHint r=tcampbell
Status: NEW → RESOLVED
Closed: 21 days ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch
No longer blocks: 1849393
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: