Closed Bug 1856658 Opened 8 months ago Closed 7 months ago

Improve the performance of `setBreakpointPositions` action

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(5 files)

In bug 1843454 profiler records:
https://share.firefox.dev/45i4Oph
We can see that we spend almost a second in setBreakpointPositions action.
This action is actually cloning and parsing a 200k array many times, while also going through many intermediate objects.
We can drastically optimize this by avoiding the use of Array's filter method.

This code is a bit hard to follow, so let's add some comments.

Also columns = [...new Set([...existing, ...columns])]; is probably very bad for performance.
It clones existing and columns into a third array, whose content is cloned into a Set,
which is ultimately cloned into the final array.

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

We can avoid the creation of an handful of object creations by passing
the "breakpoint positions" objects directly to the Source Map Loader.
(avoid convertToList)

We can also tune SourceMapLoader.getOriginalLocations output to better
fit the requirements of the main thread.

The filterBySource was looping over the whole list once again
but worse, was duplicating the array once more.

Same for filterByUniqLocation.

Finally, once we removed these two last filtering methods... we could prevent the creation of the whole "positions"
intermediate object and craft directly what we aim to store in redux.

Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/caeaed53f213
[devtools] Document breakable position retrieval and avoid instation of many Sets and Arrays. r=devtools-reviewers,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/8a22579ffeda
[devtools] Drop unused options/search argument to getOriginalLocation(s). r=devtools-reviewers,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/493f560d9831
[devtools] Better integrate SourceMapLoader into breakable positions computation. r=devtools-reviewers,nchevobbe
https://hg.mozilla.org/integration/autoland/rev/775a3be92f25
[devtools] Avoid duplicating the large breakpoints positions array when using function filtering methods. r=devtools-reviewers,nchevobbe
Pushed by djackson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/39ecb02fd8de
Fix PSM test which relied on removed Verisign Cert. r=nss-reviewers,bbeurdouche
Pushed by djackson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3bdf62c4b0fa
Fix PSM test which relied on removed Verisign Cert. r=nss-reviewers,bbeurdouche
Status: RESOLVED → REOPENED
Flags: needinfo?(nchevobbe)
Resolution: FIXED → ---
Target Milestone: 120 Branch → ---
Status: REOPENED → RESOLVED
Closed: 8 months ago7 months ago
Flags: needinfo?(nchevobbe)
Resolution: --- → FIXED
Flags: needinfo?(djackson)
Regressions: 1874411
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: