Closed Bug 1603276 Opened 4 years ago Closed 4 years ago

`toLocaleTimeString` allocate massive amounts of memory

Categories

(DevTools :: Netmonitor, defect, P3)

defect

Tracking

(Performance Impact:low, firefox73 fixed)

RESOLVED FIXED
Firefox 73
Performance Impact low
Tracking Status
firefox73 --- fixed

People

(Reporter: Harald, Assigned: Harald)

References

(Blocks 1 open bug)

Details

(Keywords: perf, perf:responsiveness)

Attachments

(2 files)

Attached image image.png

Using http://tankanarchy.herokuapp.com/ generating many WS logs leads to massive jank.

Recording with native memory allocation: https://perfht.ml/36mIbSc

In a single hang js::intl_FormatDateTime and toLocaleTimeString allocate about 30 Mb native memory.

Offending line: https://searchfox.org/mozilla-central/source/devtools/client/netmonitor/src/components/websockets/FrameListColumnTime.js#35

Solution is to re-use the same formatter instance: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/format

Summary: js::intl_FormatDateTime/toLocaleTimeString allocate massive amounts of memory → `toLocaleTimeString` allocate massive amounts of memory
Assignee: nobody → hkirschner

Before/after: https://perfht.ml/34bzvwJ

300ms per new message down to 90ms.

Tested on https://firefox-devtools-debug-ws.glitch.me/ with 500+ messages

Status: NEW → ASSIGNED
Whiteboard: [qf] → [qf:p3:responsiveness]
Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9019f3ce9559
Use cached instance of DateTimeFormat for WS frames r=Honza
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 73
Blocks: 1609232
Performance Impact: --- → P3
Whiteboard: [qf:p3:responsiveness]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: