Closed Bug 1612571 Opened 4 years ago Closed 4 years ago

Make getLastMessageId not use Array.from

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(firefox75 fixed)

RESOLVED FIXED
Firefox 75
Tracking Status
firefox75 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

With many messages to handle, getting the last message id as we do (turning a map into an array and getting the last element) takes a very long time and consumes a lot of memory:

https://searchfox.org/mozilla-central/rev/2e355fa82aaa87e8424a9927c8136be184eeb6c7/devtools/client/webconsole/reducers/messages.js#1682-1684

Assuming I understood correctly that the last message id is the id of the last message, could we just store that last message id at the time we add the message?

Logging a thousand messages instead of 10.

The id was retrieved by transforming the map into an array
and getting the last element of it. This was slow and
allocatiing a lot of memory when the messages Map contained
a lot of elements.
This patch make it so we're now storing the last message
id directly in the state so we can get it in a cheaper way.

Depends on D62184

Depends on: 1614366

Comment on attachment 9125387 [details]
Bug 1612571 - Increase number of logged messages in DAMP bulklog test. r=jdescottes.

Revision D62184 was moved to bug 1614366. Setting attachment 9125387 [details] to obsolete.

Attachment #9125387 - Attachment is obsolete: true
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f62d325fc393
Store the last message id instead of computing it from the message map. r=jlast.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: