Closed Bug 1239473 Opened 8 years ago Closed 5 years ago

Stepping in debugger gets very slow with complex scripts and deep stacks

Categories

(DevTools :: Debugger, defect)

35 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: hsteen, Unassigned)

References

Details

Attachments

(1 file)

I've long been frustrated by the debugger sometimes being slow when used for real-life tasks with complex scripts. The test I've been developing for bug 1154874 seems to prove that there is a reproducable, measurable slowdown when the stack grows. 

It would be great to have some optimisations done here!
See Also: → 1154874
(By "very slow" I mean a lag of 0.5 - 2 (!) seconds for each "Step into" ([F11]) - this is maddening if you're trying to get a quick overview of how some code runs)
(In reply to Hallvord R. M. Steen [:hallvors] from comment #1)
> (By "very slow" I mean a lag of 0.5 - 2 (!) seconds for each "Step into"
> ([F11]) - this is maddening if you're trying to get a quick overview of how
> some code runs)

Can you use the browser toolbox to collect a performance profile while reproducing this issue and upload it here?
Here's some data, captured when stepping manually in the bug 1154874 test with a pretty deep stack. I noticed significantly better performance when the devtools pane was docked to the side of the window rather than underneath. There's probably some data for each configuration in this json file.
(In reply to Hallvord R. M. Steen [:hallvors] from comment #3)
> Created attachment 8708267 [details]
> debugger-stepping-profile.json
> 
> Here's some data, captured when stepping manually in the bug 1154874 test
> with a pretty deep stack. I noticed significantly better performance when
> the devtools pane was docked to the side of the window rather than
> underneath. There's probably some data for each configuration in this json
> file.

Interesting. pullTimelineData seems to be transitively taking a huge chunk of the time here (see the flame view), which is overhead caused by the act of profiling... Seeing pauses on the order of 200-1000ms... not good :-/

Jordan, Victor: any idea how we can make pullTimelineData faster, or do less work, or do it less often, or something? This is p bad IMO.

I am also seeing some pauses from StackFrames.prototype._afterFramesCleared and StackFramesView.prototype.selectFrame, et al in debugger-controller.js but these are on the order of 50-100ms, which is also pretty bad but pales in comparison to the above.
Flags: needinfo?(vporof)
Flags: needinfo?(jsantell)
Looks like pullTimelineData, the function that gathers fresh markers from docshell, is mostly spending its time in StackFramesView.prototype.makeEvent (iterating over the array?) -- lots of `values`, `CreateArrayIterator`, and `next` functions underneath that, self-hosted, so guessing it's something with that loop.

This is a very marker heavy profile -- all the more reason to introduce non-realtime markers, because the overhead just gets more costly.
Flags: needinfo?(jsantell)
I'm curious if the debugger adds elements for everything in the stack to the DOM when it's in "landscape mode" and you have the "bread crumb"-style strip of stack frame history.. If it does it would probably explain some of the slowness and the difference between docking the debugger at the bottom ("landscape mode") and right ("portrait mode").
Agree with Jordan said. Maybe we should just bite the bullet and accept the fact that realtime markers cost too much with little benefit.
Flags: needinfo?(vporof)
Is this an issue for the debugger in general or only when it's profiling?
Product: Firefox → DevTools

closing as this is related to the old debugger.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: