Closed Bug 1607754 Opened 4 years ago Closed 4 years ago

Load about:blank in the DevTools host frame only when switching host

Categories

(DevTools :: Framework, task, P3)

task

Tracking

(firefox74 fixed)

RESOLVED FIXED
Firefox 74
Tracking Status
firefox74 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

Attachments

(1 file)

From a discussion during the review of Bug 1604491 (particularly in diff https://phabricator.services.mozilla.com/D58236).

When creating DevTools hosts, we always first load about:blank in the host iframe, before actually loading the toolbox document. As it turns out, this about:blank load is only needed when switching hosts, it ensures that the new host has a valid document before calling swapFrameLoaders.

We could skip this step in the general case, and potentially have a small speedup when creating the host.

DAMP doesn't pickup any improvement, local measures seem to indicate a 4-5 ms speedup for the Host::create method, but I need to test a bit more.

So I can definitely see some improvements using markers, but the big thing I can't tell for sure is whether this results in an overall perf improvement or if we are just making some method faster, to actually spend more time later on.

To explain a bit more, obviously not loading about:blank (and waiting for the load) makes the initial host creation faster (around 5ms on my machine). But maybe the time we are winning here will just be spent a bit later, when we load the devtools document.

To assert that I measured two things:

  • the time spent in the host::create method
  • the time between setting the iframe src to about:devtools-toolbox and receiving the corresponding DOMContentLoaded

As I hinted above I was afraid that my 5ms gained in host::create would then be lost when loading about:devtools-toolbox.
It doesn't seem to be the case. The measures I got for both are (average on 20 repetitions):

  • host::create without patch: 7.6ms
  • host::create with patch: 4.6ms
  • loading about:devtools-toolbox without patch: 27.3
  • loading about:devtools-toolbox with patch: 24.5

So overall, spread across those two measures, the patch seems to be 5 to 6ms faster (keeping in mind those are local measurements...).

All in all I think it makes more sense to load about:blank only when switching hosts, because it's only needed in this case. So beyond the performance discussion, I think dropping the initial about:blank load simply makes the host creation easier to understand. And if it slightly improves the performance, even better.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Blocks: 1610277
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7db21ab8b633
Only load about:blank in the devtools frame when switching hosts r=ochameau
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: