-
Notifications
You must be signed in to change notification settings - Fork 758
Throttle new sources #4749
Throttle new sources #4749
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is really good work. i tried it out, quite an impressive improvement
src/actions/sources.js
Outdated
let urls = null; | ||
try { | ||
urls = await sourceMaps.getOriginalURLs(generatedSource); | ||
} catch (e) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be in its own PR probably. It can throw, and that breaks things
for (const source of filteredSources) { | ||
await dispatch(newSource(source)); | ||
await dispatch(loadSourceMap(source)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can send the promises all at once using Promise.all? especially with the queue work. and if we move to sagas we can use forks
damp benchmark:
my computer was struggling a bit so some of the values are higher than normal |
for (const source of filteredSources) { | ||
await dispatch(newSource(source)); | ||
await dispatch(loadSourceMap(source)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I tried to break this work up a bit so that we can land it piecemeal. This logic will be touched in another PR
Just checked CI: two mochitests, and one lint error. This should be pretty close :) |
browser_dbg-breakpoints-cond |
f59026d
to
a9a2933
Compare
looks like it's failing because we're not selecting the source or waiting for the source to be selected.. diff --git a/src/actions/pause/paused.js b/src/actions/pause/paused.js
index c4c8b4e..7a29545 100644
--- a/src/actions/pause/paused.js
+++ b/src/actions/pause/paused.js
@@ -51,6 +51,7 @@ export function paused(pauseInfo: Pause) {
}
const { line, column } = frame.location;
+ debugger;
await dispatch(
selectSource(frame.location.sourceId, { location: { line, column } })
);
diff --git a/src/actions/sources.js b/src/actions/sources.js
index ddb437b..44f656a 100644
--- a/src/actions/sources.js
+++ b/src/actions/sources.js
@@ -66,6 +66,12 @@ async function checkPendingBreakpoints(state, dispatch, sourceId) {
// load the source text if there is a pending breakpoint for it
await dispatch(loadSourceText(source));
}
diff --git a/src/test/mochitest/browser_dbg-breaking.js b/src/test/mochitest/browser_dbg-breaking.js
index a4fdfa7..61263ee 100644
--- a/src/test/mochitest/browser_dbg-breaking.js
+++ b/src/test/mochitest/browser_dbg-breaking.js
@@ -13,7 +13,9 @@ add_task(async function() {
reload(dbg);
await waitForPaused(dbg);
- await waitForLoadedSource(dbg, "doc-scripts.html");
+ await waitForSelectedSource(dbg, "doc-scripts.html");
+ debugger
+ // await waitForever()
assertPausedLocation(dbg);
await resume(dbg);
|
Got this working on the plane, turned out we had a sneaky timing w/ pause and sources. Now that we're throttling the newSources action, we need to flush it before firing the pause action. There were also some small nits in there too. Should be ready to go! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks!
* Throttle new source * fixes * fix lint error
* Throttle new source * fixes * fix lint error
This reverts commit a197a1e.
This reverts commit a197a1e. # Conflicts: # src/actions/sources.js
This reverts commit 0a589ec.
This reverts commit a197a1e.
This reverts commit 0a589ec.
Associated Issue: #4705
Summary of Changes
This throttles the firefox newSource event so that we fire at most one newSources action every 50ms.
The performance savings is significant ⏲
No throttling, w/o the editor fix
~ 9 seconds. Lots of thrashing here :P
Throttling w/o the editor fix
3 seconds. The editor update holds up the main thread so we also do more newSources calls :) vicious cycle
Throttling w/ the editor fix
1.5 sec