Closed Bug 1516197 Opened 5 years ago Closed 5 years ago

Debugger loads slowly

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(firefox66 fixed)

RESOLVED FIXED
Firefox 66
Tracking Status
firefox66 --- fixed

People

(Reporter: jlast, Assigned: jlast)

Details

Attachments

(2 files)

It looks like we made a change lately that slows the debugger down on initial open.

STR:

1. go to a complicated page (e.g localhost:8000 for the launchpad)
2. cmd+option+i w/ debugger as the default


slow: https://perfht.ml/2RgxPzx
fast: https://perfht.ml/2GzMjq4

When I measured it in perf.html it looked like ThreadActor.onSources was pretty slow... The last change too it removed a Promise.all, which might have made the fetch non-blocking... I'm not too sure

Reverting that change seems to speed it up

> diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js
> index c9c87265863e..105a70bdbe09 100644
> --- a/devtools/server/actors/thread.js
> +++ b/devtools/server/actors/thread.js
> @@ -1235,10 +1235,10 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
>      return res ? res : {};
>    },
> 
> -  onSources: function(request) {
> -    for (const source of this.dbg.findSources()) {
> +  onSources: async function(request) {
> +    await Promise.all(this.dbg.findSources().map(source => {
>        this.sources.createSourceActor(source);
> -    }
> +    }));
> 
>      // No need to flush the new source packets here, as we are sending the
>      // list of sources out immediately and we don't need to invoke the
> (END)
Assignee: nobody → jlaster
Attachment #9033303 - Flags: review?(bhackett1024)
Attachment #9033303 - Flags: review?(bhackett1024) → review+
Pushed by jlaster@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e2ba0eeb80c7
Improve Thread.onSources performance. r=bhackett
https://hg.mozilla.org/mozilla-central/rev/e2ba0eeb80c7
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 66
It looks like I might have jumped the gun here... 

here is a profile of Firefox Nightly with the change -- https://perfht.ml/2Rgk5oB

It looks like `this.emit("newSource", actor)` might be the problem, perhaps this patch https://searchfox.org/mozilla-central/diff/b03057f1e8526bba8979955ddd39aee0e649b463/devtools/server/actors/utils/TabSources.js#142 should not have dropped this condition `if (!actor.source) {`?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
The main change from my patch is that `this.emit("newSource", actor);` used to run in the next microtask, whereas now it is running synchronously from `onSources`. That seems like the most likely issue?
Priority: -- → P2
Pushed by lsmyth@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1deebf9d09a8
Delay newSource packet processing to avoid blocking onSources. r=jlast
https://hg.mozilla.org/mozilla-central/rev/1deebf9d09a8
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: