Skip to content

Hitting the first breakpoint when debugging seems quite slow compared to the old debugger #206

Closed

Description

@eamodio

I'm using with the Extension Host debugger and it seems to take quite a while (many seconds) for the first breakpoint to be hit. Subsequent breakpoints seem fine.

Activity

  1. connor4312 commented on Jan 6, 2020

    @connor4312
    Member

    Can you toss a log up for this? 🙂

  2. eamodio commented on Jan 6, 2020

    @eamodio
    ContributorAuthor

    Both logs are hitting the same breakpoint after a clean start.
    vscode-debugadapter.zip

    This one too much longer than the first.
    vscode-debugadapter (2).zip

  3. connor4312 commented on Jan 7, 2020

    @connor4312
    Member

    Hm. Looking at the logs it seems like there's a delay, of varying size, between when we tell VS Code we stopped and when it requests a stack frames. Running on my machine this was 4-5 seconds, setting a breakpoint in extension.ts' activate.

    image

    ...and in your logs it's around 10 seconds. Looking in VS Code sources, it seems like the 'threads' request gets fired off synchronously as soon as it sees a stopped event. The stop comes after we throw a whole lot of loadedSource requests over the connection, so I wondered if we had a queue that gets bogged down. We log the all events and their times on the adapter side, and I added a console.log(Date.now()) here. There was a 5 second difference from when js-debug sent the event to when vs code processed it, which lines up with what I was seeing.

    Logged send     : 1578416835848
    Logged received : 1578416840796 (+4948ms)
    

    Running this case in the old debug adapter versus this one, node-debug2 emits 231 loadedSource events versus 1662 for js-debug; this is because js-debug reads and creates sources from the sourcemaps discovered at runtime, whereas node-debug2 does not factor in source maps to loaded scripts.

    Possible solutions:

    1. Don't emit loaded scripts for source maps. I don't want to do this, since having sourcemapped scripts makes the panel much more valuable when dealing with bundlers. Doing web or extension work and only being able see the big webpack-compiled bundle (that might be mangled with eval-sourcemaps) is not useful.
    2. Fix the slowness in VS Code's processing of events.
    3. Allow us to bulk together loadedSource events in DAP to reduce total message count; those 1.6k messages happen over a second or two, and could be easily debounced and bulked.

    Isidor Nikolic (@isidorn) thoughts?

  4. eamodio commented on Jan 7, 2020

    @eamodio
    ContributorAuthor

    Yeah, I have definitely seen a wide variance in delays -- sometimes (and it feels like for certain breakpoints) things can happen quickly, and for others it can take a long time (and I should note I'm on a very fast desktop machine).

  5. added
    under-discussion
    on Jan 7, 2020
  6. isidorn commented on Jan 8, 2020

    @isidorn

    I can also reproduce some slowness in some other cases (when running vscode unit tests the time it takes to hit the first breakpoint can be slow).
    Let's first try to fix 2)
    My suspect is this PR microsoft/vscode#81403
    Since when reverting it I could not see big slowness on my machine
    Connor Peet (@connor4312) can you please check if reverting that PR makes a difference for you? And if yes could we either revert or improve that PR such that the slowdown is not so signifcant?

  7. connor4312 commented on Jan 8, 2020

    @connor4312
    Member

    That indeed seems to be the case, reverting it drops the delta from ~5s to 43ms. I'll take a look at the PR this afternoon and see what we can do.

  8. isidorn commented on Jan 8, 2020

    @isidorn

    Great, thanks!

  9. removed
    under-discussion
    on Jan 10, 2020
  10. connor4312 commented on Jan 13, 2020

    @connor4312
    Member

    Should be fixed in tomorrow's insiders. Reopen if not :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions