Simplify a few things between SourceTree utilities and the main selector used to populate it
Categories
(DevTools :: Debugger, enhancement)
Tracking
(firefox103 fixed)
Tracking | Status | |
---|---|---|
firefox103 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
(Blocks 1 open bug)
Details
Attachments
(10 files, 2 obsolete files)
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
The SourceTree is solely based on getDisplayedSources
reducer:
https://searchfox.org/mozilla-central/rev/32ca4fc265150e7d3d7aa6c6abea088768cf024b/devtools/client/debugger/src/selectors/sources.js#255-296
i.e. this is dedicated to the SourceTree.
The SourceTree pass this selector data to createTree
:
https://searchfox.org/mozilla-central/rev/32ca4fc265150e7d3d7aa6c6abea088768cf024b/devtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js#60-64
And updateTree
:
https://searchfox.org/mozilla-central/rev/32ca4fc265150e7d3d7aa6c6abea088768cf024b/devtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js#132-142
Which maintains a mutable copy of the selector data used by ManagedTree/Tree to display the sources.
Ideally, the selector would craft this data directly instead of having these two layers.
In this bug I'll start to cleanup a few things and move what can easily be moved to the selector.
Assignee | ||
Comment 1•2 years ago
|
||
Before, only "shown source" would really expand the tree to show the source in tree,
whereas "highlight" would only highlight the folder that is opened
(in case the source isn't visible and folder isn't expanded).
But when we select a new shown source, we also update the selected location,
which also changes the highlight items.
It is significantly clearer to only have "selected source" and have the SourceTree
to automatically expand the tree and show the selected source.
(Also a sneaky call to .reverse() was mutating the highlightedItems
props...)
Assignee | ||
Comment 2•2 years ago
|
||
Assignee | ||
Comment 3•2 years ago
|
||
The classname looks useless and so is the debugeeUrl prop.
Assignee | ||
Comment 4•2 years ago
|
||
At the end, we weren't using the url but only the host.
And "debuggee" is pretty vague, let's clarify with "main thread".
Assignee | ||
Comment 5•2 years ago
|
||
This argument is only used in getDisplayURL.
Assignee | ||
Comment 6•2 years ago
|
||
Assignee | ||
Comment 7•2 years ago
|
||
Surprisingly, all these changes have no impact on DAMP:
https://treeherder.mozilla.org/perfherder/comparesubtest?originalProject=mozilla-central&newProject=try&newRevision=8002719c0fd8ea25a7b748c1f8dcbcd97bbcaabc&originalSignature=3147964&newSignature=3130994&framework=12&selectedTimeRange=172800&page=1&showOnlyComparable=1&showOnlyImportant=1
I would have expected the many calls to getDisplayURL or any added extra computation in the selector to immediately become visible as a regression. But no.
Assignee | ||
Comment 8•2 years ago
|
||
We were using isInvalidUrl
late in the process of updateTree layer to ignore sources
and prevent displaying them in the SourceTree.
But getDisplayedSources is dedicated to the SourceTree and can eagerly filter out the right sources
right away.
Also getDisplayedSourceIDs is already accepting only source with a URL,
so we don't have to recheck if the source is having a URL.
I extended mochitest test coverage to replace the removed jest tests.
Assignee | ||
Comment 9•2 years ago
|
||
Assignee | ||
Comment 10•2 years ago
|
||
Assignee | ||
Comment 11•2 years ago
|
||
This helps compute it only once per source and help simplify the updateTree layer.
We no longer have to path thread/mainThreadHost everywhere.
Assignee | ||
Comment 12•2 years ago
|
||
Still no visible impact on DAMP:
https://treeherder.mozilla.org/perfherder/comparesubtest?originalProject=mozilla-central&newProject=try&newRevision=b2edadf110081e75cb6ec9be044942d18c20b4c4&originalSignature=3147964&newSignature=3130994&framework=12&selectedTimeRange=172800&page=1&showOnlyConfident=1&showOnlyImportant=1
(I'm comparing against m-c, I think there has been some other fixes/improvements landed recently)
Updated•2 years ago
|
Assignee | ||
Comment 13•2 years ago
|
||
At the end getDisplayedSources wasn't correctly memoized and generates new array instances
even if the content of the source tree doesn't change.
That's because internaly, it crafts an array which is always a new array instance.
Let's merge the two intermediate selectors into a single one so that we can more easily memoize it.
This should also help try to followup and attempt at generating the data structure needed for ManagedTree.
That, instead of generated the data for addToTree/updateTree which then feeds ManagedTree.
Comment 14•2 years ago
|
||
Comment on attachment 9280072 [details]
Bug 1771939 - [devtools] Merge getDisplayedSources selectors into a unique one and ensure it is memoized.
Revision D148526 was moved to bug 1773258. Setting attachment 9280072 [details] to obsolete.
Comment 15•2 years ago
|
||
Comment 16•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/508011e63277
https://hg.mozilla.org/mozilla-central/rev/36c76c6b65ba
https://hg.mozilla.org/mozilla-central/rev/8e5007ad2e4a
https://hg.mozilla.org/mozilla-central/rev/bfaaa1a81fdb
https://hg.mozilla.org/mozilla-central/rev/b82a549bcf50
https://hg.mozilla.org/mozilla-central/rev/f9dc3e01a799
https://hg.mozilla.org/mozilla-central/rev/42d229e6862b
https://hg.mozilla.org/mozilla-central/rev/94381d1b8b87
https://hg.mozilla.org/mozilla-central/rev/03bc06fe9208
https://hg.mozilla.org/mozilla-central/rev/18133832490e
Updated•2 years ago
|
Comment 17•2 years ago
|
||
== Change summary for alert #34401 (as of Fri, 10 Jun 2022 14:00:28 GMT) ==
Regressions:
Ratio | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|
8% | damp custom.jsdebugger.project-search.DAMP | macosx1015-64-shippable-qr | e10s fission stylo webrender-sw | 840.85 -> 911.85 |
7% | damp custom.jsdebugger.project-search.DAMP | macosx1015-64-shippable-qr | e10s fission stylo webrender | 866.23 -> 922.74 |
6% | damp custom.jsdebugger.preview.DAMP | linux1804-64-shippable-qr | e10s fission stylo webrender | 526.91 -> 555.96 |
5% | damp custom.jsdebugger.project-search.DAMP | windows10-64-shippable-qr | e10s fission stylo webrender-sw | 915.04 -> 965.13 |
5% | damp custom.jsdebugger.project-search.DAMP | windows10-64-shippable-qr | e10s fission stylo webrender | 915.26 -> 962.47 |
5% | damp custom.jsdebugger.preview.DAMP | linux1804-64-shippable-qr | e10s fission stylo webrender-sw | 523.07 -> 549.60 |
4% | damp custom.jsdebugger.preview.DAMP | windows10-64-shippable-qr | e10s fission stylo webrender-sw | 495.62 -> 514.89 |
4% | damp custom.jsdebugger.preview.DAMP | windows10-64-shippable-qr | e10s fission stylo webrender | 498.02 -> 516.87 |
3% | damp custom.jsdebugger.open.DAMP | windows10-64-shippable-qr | e10s fission stylo webrender | 625.66 -> 646.16 |
2% | damp custom.jsdebugger.reload.DAMP | linux1804-64-shippable-qr | e10s fission stylo webrender-sw | 699.48 -> 714.82 |
2% | damp custom.jsdebugger.pause.DAMP | windows10-64-shippable-qr | e10s fission stylo webrender | 251.56 -> 256.70 |
2% | damp custom.jsdebugger.pause.DAMP | windows10-64-shippable-qr | e10s fission stylo webrender-sw | 251.36 -> 256.48 |
2% | damp custom.jsdebugger.stepIn.DAMP | windows10-64-shippable-qr | e10s fission stylo webrender | 648.86 -> 661.88 |
2% | damp simple.jsdebugger.reload.DAMP | linux1804-64-shippable-qr | e10s fission stylo webrender-sw | 293.17 -> 299.04 |
Improvements:
Ratio | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|
6% | damp complicated.inspector.close.DAMP | macosx1015-64-shippable-qr | e10s fission stylo webrender-sw | 17.07 -> 15.98 |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=34401
Assignee | ||
Comment 18•2 years ago
|
||
Comment 19•2 years ago
|
||
Comment on attachment 9280072 [details]
Bug 1771939 - [devtools] Merge getDisplayedSources selectors into a unique one and ensure it is memoized.
Revision D148526 was moved to bug 1773258. Setting attachment 9280072 [details] to obsolete.
Comment 20•2 years ago
|
||
Comment on attachment 9281178 [details]
Bug 1771939 - [devtools] Avoid modifying sourcesWithUrls when sources without a URL is removed.
Revision D149235 was moved to bug 1773258. Setting attachment 9281178 [details] to obsolete.
Description
•