Closed Bug 1873066 Opened 4 months ago Closed 4 months ago

Investigate calls to Array.includes from isInRemovedId and UNSAFE_componentWillUpdate/isOpeningGroup<

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(firefox123 fixed)

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file, 1 obsolete file)

In bug 1873065 STR, we freeze very frequently, and this seems to mostly involve costly usages of Array.includes.

These usages are only coming from two methods:

These function may be called too frequently and/or manipulating too large objects.
Or we may review a different logic to avoid having to do these computations.

Here is a profiler record bug 1873065 STR:
https://share.firefox.dev/41Pjfkj

A simplier STR:
data:text/html,<script>let r; window.onclick=()=>{if (r) {clearInterval(r)} else r=setInterval(()=>{for(let i=0; i<50; i++){console.log(Math, []); console.trace();}},10);}</script>
This reproduces the amount and type of messages being logged in bug 1873065 STR.
This highlights a serious amount of messages being logged: 10000 per seconds (50 every 10ms - I'm not sure the original STR really follow this pattern):

  • 5000 console.log logging an object and an empty array
  • 5000 console.trace
Depends on: 1534938

The "is in opening group" computation, which goes through all message arrays
can be avoided until it is meaningful to check for this particular edge case.
Also we can remove the redundant check against nextProps.messagesUi.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED

As we are only doing inclusion test, and this dataset is often large,
this will be signficantly faster.

Severity: -- → S3
Priority: -- → P2
Depends on: 1874696

Comment on attachment 9371262 [details]
Bug 1873066 - [devtools] Use a Set (instead of Array) for removed message IDs.

Revision D197771 was moved to bug 1874696. Setting attachment 9371262 [details] to obsolete.

Attachment #9371262 - Attachment is obsolete: true
Blocks: 1875045
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1dfd3ed21415
[devtools] Avoid some computation when receiving new messages. r=devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: