Open Bug 1521539 Opened 7 years ago Updated 3 years ago

improve setBreakpointAtGeneratedLocation performance

Categories

(DevTools :: Debugger, enhancement, P2)

enhancement

Tracking

(Not tracked)

People

(Reporter: jlast, Unassigned)

References

(Blocks 1 open bug)

Details

General Debugger slowness (https://github.com/devtools-html/debugger.html/issues/7734) helped us find a slow path setBreakpointAtGeneratedLocation.

Brian shared some comments in slack:

It looks like setBreakpointAtGeneratedLocation will be very expensive on large projects, both on the platform and on the devtools server side

If there's a single bundle of 14MB of JS code, all in one file and all (probably?) on one line in the generated source every time we set a breakpoint, generatedSourceActor._findDebuggeeScripts will enumerate every script in that bundle of JS code since the breakpoint is presumably a column breakpoint (if it was set from a location in the source mapped file) we then iterate through every one of those scripts and get the column of every pc in the script to compute a map look through that map to see if any of the columns falls in the range of the location we are trying to set the breakpoint at.

I don't think it's surprising that this could take a half second on a large project. It could be O(log N), if we do a binary search.
I wouldn't worry about other performance bottlenecks here until the computational complexity here is where it should be.

We had problems like this a lot in spidermonkey and fixing them can be a huge boost in performance, even on smaller apps where it isn't as noticeable.

What I think would be a good next step, actually, is create an example extremely large webapp that has a similar size / characteristics to salomvary's app. It would be easier to experiment with fixes and would have simpler profiles, we could easily measure the effects of fixes.

Blocks: 1521540
No longer blocks: 1521540

STR:

  1. go to https://perf-html.io
  2. add a breakpoint in CallTree#componentDidUpdate
  3. refresh

profile

I think this will benefit from Logan's breakpoint specificity work --

https://bugzilla.mozilla.org/show_bug.cgi?id=1518661

Blocks: dbg-perf-q1
Whiteboard: [debugger-mvp]
Whiteboard: [debugger-mvp] → [debugger-reserve]
No longer blocks: dbg-71
Whiteboard: [debugger-reserve]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.