Closed Bug 1854423 Opened 1 year ago Closed 1 year ago

Optimize the getColumnBreakpoints selector

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(firefox120 fixed)

RESOLVED FIXED
120 Branch
Tracking Status
firefox120 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

Here is a record of bug 1843454 STR:
https://share.firefox.dev/3Lwgcqi
On this 50s record, we spend 1.5s in getColumnBreakpoints selector:
https://searchfox.org/mozilla-central/rev/077fc34d03b85b09add26b5f99f1a3a3a72c8720/devtools/client/debugger/src/selectors/visibleColumnBreakpoints.js#124-151
This probably causes some junks as it happens in the main thread.

Following this str, we do manipulate an array with 260k elements.
Quickly looking at its implementation, there is lots of room for improvement.

Checking for isOriginal boolean is much faster as it avoid a string comparison and function calls.

  • filterByLineCount was just a very costly non-sense filtering nothing.
    (comes from unreviewed code https://github.com/firefox-devtools/debugger/pull/7349)
  • The filter using lineText isn't clear either.
    Why would breakpoint position include breakpoint after the end of the actual line text content??

With the attached patch, I get down to less than 180ms spent in this selector.
https://share.firefox.dev/48r2z5K

Depends on: 1854941
Blocks: 1855019
Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Depends on: 1855910
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/409956a5ade5 [devtools] Stop querying isOriginalId from getSelectedLocation. r=nchevobbe,devtools-reviewers https://hg.mozilla.org/integration/autoland/rev/9feea518d33a [devtools] Optimize and simplify getVisibleColumnBreakpoint selector. r=devtools-reviewers,bomsy
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch

== Change summary for alert #39943 (as of Thu, 12 Oct 2023 20:34:05 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
5% damp custom.jsdebugger.stepIn.DAMP linux1804-64-shippable-qr e10s fission stylo webrender-sw 567.13 -> 539.64
4% damp custom.jsdebugger.pretty-print.reload-and-pause.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 8,510.49 -> 8,211.90
3% damp custom.jsdebugger.stepInNewSource.DAMP windows10-64-shippable-qr e10s fission stylo webrender 569.72 -> 552.27
3% damp custom.jsdebugger.pretty-print.reload-and-pause.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender-sw 8,460.01 -> 8,206.87
3% damp custom.pretty-print.jsdebugger.reload.DAMP macosx1015-64-shippable-qr e10s fission stylo webrender 8,304.10 -> 8,059.49
2% damp custom.jsdebugger.pretty-print.reload-and-pause.DAMP windows10-64-shippable-qr e10s fission stylo webrender 8,308.96 -> 8,108.50

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=39943

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: