Closed Bug 1463555 Opened 6 years ago Closed 6 years ago

Queue adding the tabs to the inspector sidebar

Categories

(DevTools :: Inspector, enhancement, P3)

enhancement

Tracking

(firefox62 fixed)

RESOLVED FIXED
Firefox 62
Tracking Status
firefox62 --- fixed

People

(Reporter: gl, Assigned: gl)

References

Details

Attachments

(1 file)

We can significantly improve the performance of adding the sidebar panels to the inspector sidebar by queuing up all the tabs to add, and setting the new state once to reduce the number of renders that occur for each time we call setState from adding a new tab.
Summary: Queue adding the → Queue adding the tabs to the inspector sidebar
Blocks: 1462648
Comment on attachment 8979831 [details]
Bug 1463555 - Queue adding the tabs to the inspector sidebar.

https://reviewboard.mozilla.org/r/246002/#review252110

Thansk for working on this Gabriel.

Looks good to me, but please see my inline comments.

Also, I am curious how much this improves the performance.
Do you have some data from Talos prooving that
this makes the UI faster?

Honza

::: devtools/client/shared/components/tabs/TabBar.js:145
(Diff revision 1)
> +
> +    let tabs = this.state.tabs.slice();
> +    let activeId;
> +    let activeTab;
> +
> +    for (let { id, index, panel, selected, title, url } of this.queuedTabs) {

Content of this loop is duplicating `addTab` method. Can you reuse that method in the loop? Or use another way to dup the code?

::: devtools/client/shared/components/tabs/TabBar.js:172
(Diff revision 1)
> +    });
> +
> +    this.queuedTabs = [];
> +  }
> +
> +  queueTab(id, title, selected = false, panel, url, index = -1) {

Please add a comment explaining why tab-queuing APIs have been introduced.
Attachment #8979831 - Flags: review?(odvarko)
Comment on attachment 8979831 [details]
Bug 1463555 - Queue adding the tabs to the inspector sidebar.

https://reviewboard.mozilla.org/r/246002/#review252110

> Content of this loop is duplicating `addTab` method. Can you reuse that method in the loop? Or use another way to dup the code?

I don't think we can do anything about reusing the code in a helper or using the addTab method here. The point of this was to limit the setState call to just once with all the queued tabs.
Comment on attachment 8979831 [details]
Bug 1463555 - Queue adding the tabs to the inspector sidebar.

https://reviewboard.mozilla.org/r/246002/#review252478

Thanks for the update!

R+ assuming try is green

Honza
Attachment #8979831 - Flags: review?(odvarko) → review+
Pushed by gabriel.luong@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7690bdfe60a0
Queue adding the tabs to the inspector sidebar. r=Honza
Pushed by gabriel.luong@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/30c7c7093432
Followup: Remove unexpected 'debugger' statement. r=me CLOSED TREE
https://hg.mozilla.org/mozilla-central/rev/7690bdfe60a0
https://hg.mozilla.org/mozilla-central/rev/30c7c7093432
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 62
Thanks Gabriel, this patch recovered a significant part of the 3panes regression.
Two mores like this one and we get back to the baseline perf :)

http://firefox-dev.tools/performance-dashboard/perfherder/?test=complicated.inspector.open&days=14&filterstddev=true
Noticed perf improvements:

== Change summary for alert #13621 (as of Thu, 24 May 2018 17:56:10 GMT) ==

Improvements:

  4%  damp windows10-64 pgo e10s stylo     85.00 -> 81.20

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=13621
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: