Closed
Bug 817543
Opened 13 years ago
Closed 13 years ago
[toolbox] is slow to start
Categories
(DevTools :: Framework, defect, P1)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 20
People
(Reporter: paul, Assigned: paul)
References
Details
Attachments
(3 files, 5 obsolete files)
141.24 KB,
patch
|
jwalker
:
review+
|
Details | Diff | Splinter Review |
18.22 KB,
patch
|
jwalker
:
review+
|
Details | Diff | Splinter Review |
155.57 KB,
patch
|
Details | Diff | Splinter Review |
Starting the inspector in a pre-toolbox build is pretty fast.
In a post-toolbox, it takes several seconds. This can be explained by bug 796006. But I have the feeling that it's not the only reason.
We need to have some real measurements, and understand where the regression lies (toolbox? inspector? both? are the other tools affected?).
Comment 1•13 years ago
|
||
Also curious to know if the regression happens once the first time the tools are loaded or if it's repeatable. I think it's the latter, but need data.
Comment 2•13 years ago
|
||
After observing a little, I also think its the latter.
Assignee | ||
Comment 3•13 years ago
|
||
Starting an empty tool (about:blank):
first time: ~350ms
second time: ~160ms
By "starting" I mean: from the XUL command to the "ready" event from the toolbox (fired once all the toolbox DOM operations are done). So it doesn't include loading the tool itself. Once "ready" is fired, the toolbox is built, the iframe that will hold the default tool is built too, but the tool is still loading.
In the case of the empty tool, the tool is loaded 50ms after the "ready" event. More data about that will come later.
One important thing: opening the toolbox feels jumpy because we first show a grey box, that then gets filled with the toolbox content. This happens because we first load "about:blank" in the host. Avoiding that and loading toolbox.xul directly will probably improve the performance and avoid this grey screen. But apparently, we need to load about:blank for some docshell swapping reasons that I don't understand yet.
Assignee | ||
Comment 4•13 years ago
|
||
The "first time" value can go up to 500ms.
Assignee | ||
Comment 5•13 years ago
|
||
All the Tilt code was loaded while opening the toolbox. Lazy loading makes us win ~50ms.
Not loading about:blank doesn't change much.
Assignee | ||
Comment 6•13 years ago
|
||
First startup: 270ms is spent loading gcli.jsm.
Comment 7•13 years ago
|
||
(In reply to Paul Rouget [:paul] from comment #6)
> First startup: 270ms is spent loading gcli.jsm.
holy moley
Assignee | ||
Comment 8•13 years ago
|
||
Most of the time is spent in:
220ms in this.gcli = require('gcli/index');
60ms between Toolbox._host.open() and Toolbox._host.once("ready")
40ms to "just" load (DOM loaded) toolbox.xul
25ms in Toolbox._buildTabs()
130ms in Toolbox._buildButtons() (gcli buttons)
15ms in Toolbox.selectTool()
Gcli is seriously slowing us down (220ms + 130ms).
I think the first 60ms can be avoided.
Assignee | ||
Comment 9•13 years ago
|
||
The above numbers represents 83% of the time spent between clicking on a the menuitem and the final "ready" event (589ms).
Assignee | ||
Comment 10•13 years ago
|
||
When the gcli start, we read and sort all the preferences in gcli/settings.startup. This takes 160ms (27% of total time). We can probably do that in a lazy way.
http://mxr.mozilla.org/mozilla-central/source/browser/devtools/commandline/gcli.jsm#4694
Assignee | ||
Comment 11•13 years ago
|
||
These 3 lines, combined, take 30 extra milliseconds:
> canon.addCommand(prefShowCmdSpec);
> canon.addCommand(prefSetCmdSpec);
> canon.addCommand(prefResetCmdSpec);
Assignee | ||
Comment 12•13 years ago
|
||
15% spent in:
> let toolbarSpec = CommandUtils.getCommandbarSpec("devtools.toolbox.toolbarSpec");
Assignee | ||
Comment 13•13 years ago
|
||
Reaching the pref doesn't take time. But loading the DeveloperToolbar.jsm does.
Assignee | ||
Comment 14•13 years ago
|
||
This:
Cu.import("resource:///modules/devtools/CmdAddon.jsm");
Cu.import("resource:///modules/devtools/CmdBreak.jsm");
Cu.import("resource:///modules/devtools/CmdCalllog.jsm");
Cu.import("resource:///modules/devtools/CmdCalllogChrome.jsm");
Cu.import("resource:///modules/devtools/CmdConsole.jsm");
Cu.import("resource:///modules/devtools/CmdCookie.jsm");
Cu.import("resource:///modules/devtools/CmdDbg.jsm");
Cu.import("resource:///modules/devtools/CmdEcho.jsm");
Cu.import("resource:///modules/devtools/CmdEdit.jsm");
Cu.import("resource:///modules/devtools/CmdExport.jsm");
Cu.import("resource:///modules/devtools/CmdInspect.jsm");
Cu.import("resource:///modules/devtools/CmdJsb.jsm");
Cu.import("resource:///modules/devtools/CmdPagemod.jsm");
Cu.import("resource:///modules/devtools/CmdResize.jsm");
Cu.import("resource:///modules/devtools/CmdRestart.jsm");
Cu.import("resource:///modules/devtools/CmdScreenshot.jsm");
Cu.import("resource:///modules/devtools/CmdTilt.jsm");
Cu.import("resource:///modules/devtools/CmdScratchpad.jsm");
Is killing us.
This is called because:
Commands.jsm is loaded because:
DeveloperToolbar is loaded because:
CommandUtils is needed to build the buttons in the toolbox.
We should move CommandUtils into Toolbox.jsm (or at least the functions, not the exported symbol).
Assignee | ||
Comment 15•13 years ago
|
||
Apparently, we need to load all of these to know if the command-button is a known command or not.
So moving commandUtils code into Toolbox.jsm won't help.
Assignee | ||
Comment 16•13 years ago
|
||
To summarize my current research:
For an basic tool:
220ms in this.gcli = require('gcli/index'); Because we read and then sort all the preferences (gcli/settings).startup(). (comment 10).
130ms in Toolbox._buildButtons() (gcli buttons); Because to build the buttons, we need to know if the commands exist, so we have to load all the commands (comment 14 and comment 15).
There are other places where we can improve the code, but these are the 2 most obvious things we need to fix.
Assignee | ||
Comment 17•13 years ago
|
||
Loading about:blank in the host doesn't have any significant impact.
Assignee | ||
Comment 18•13 years ago
|
||
(In reply to Paul Rouget [:paul] from comment #17)
> Loading about:blank in the host doesn't have any significant impact.
We actually need it (to have something to swap in the devtools window).
Assignee | ||
Comment 19•13 years ago
|
||
Using "visibility:collapse" on the iframe and switching it to "visibility:visible" prevents the empty pane. Less flickering, but the box shows up a little later. But it feels better.
Assignee | ||
Comment 20•13 years ago
|
||
Conclusion:
- lazy load Tilt
- don't show the host iframe until ready (not the tool iframe)
- fix gcli loading (the pref thing and the multiple JSMs loading)
For the Gcli, we can:
- move this big chunk of JSMs into one JSM
- postpone the creation of the buttons (timeout 500ms?)
- not require to read all the commands, and assume they exist, and load all the commands only when the button is pressed
For the pref thing, I don't know. I need Joe here.
Assignee | ||
Comment 21•13 years ago
|
||
Joe - can you take a look at comment 16 and comment 20 and tell me what you think.
Flags: needinfo?(jwalker)
Assignee | ||
Updated•13 years ago
|
Priority: -- → P1
Comment 22•13 years ago
|
||
Flags: needinfo?(jwalker)
Updated•13 years ago
|
Attachment #691784 -
Flags: review?(paul)
Assignee | ||
Comment 23•13 years ago
|
||
Comment on attachment 691784 [details] [diff] [review]
This should solve the gcli/settings/prefs part of the puzzle
The preferences are still read and sorted as soon as gcli.jsm is loaded.
Attachment #691784 -
Flags: review?(paul) → review-
Assignee | ||
Comment 24•13 years ago
|
||
Work in progress (see PR here: https://github.com/paulrouget/mozilla-central/pull/1).
Starting the WebConsole:
- without this patch: ~750ms
- with this patch: ~450ms
Lazy pref loading will probably bring us to a 50% improvement.
Comment 25•13 years ago
|
||
Assignee: nobody → jwalker
Attachment #691784 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #692980 -
Flags: review?(paul)
Comment 26•13 years ago
|
||
Paul - see also https://github.com/joewalker/gcli/pull/5
Comment 27•13 years ago
|
||
Just noticed a stray 'console.trace' in the patch. Removed.
Attachment #692980 -
Attachment is obsolete: true
Attachment #692980 -
Flags: review?(paul)
Attachment #693283 -
Flags: review?(paul)
Assignee | ||
Comment 28•13 years ago
|
||
~40% improvements + better cold-startup experience.
Assignee: jwalker → paul
Attachment #693283 -
Attachment is obsolete: true
Attachment #693283 -
Flags: review?(paul)
Assignee | ||
Updated•13 years ago
|
Summary: [toolbox] or [inspector] is slow to start → [toolbox] is slow to start
Assignee | ||
Comment 29•13 years ago
|
||
PR: https://github.com/paulrouget/mozilla-central/pull/1
try: https://tbpl.mozilla.org/?tree=Try&rev=cf4006473118
Attachment #693343 -
Attachment is obsolete: true
Attachment #693357 -
Flags: review?(jwalker)
Updated•13 years ago
|
Attachment #693357 -
Flags: review?(jwalker) → review+
Assignee | ||
Updated•13 years ago
|
Whiteboard: to land once try is green
Assignee | ||
Comment 30•13 years ago
|
||
Not green:
- (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: chrome://mochitests/content/browser/browser/devtools/commandline/test/browser_cmd_addon.js
- TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/browser/devtools/markupview/test/browser_inspector_markup_edit.js | Test timed out (not intermittent as in bug 816953)
Comment 31•13 years ago
|
||
Not being able to find a test file really is bizarre. I re-triggered the Linux platform to see if there might be a build error that a clobber might help.
Maybe makefile commenting could have cause it?
Assignee | ||
Comment 32•13 years ago
|
||
Not, it's normal. It's because we use CmdAddons.jsm and not BuiltinCommands.jsm in the test.
Assignee | ||
Comment 33•13 years ago
|
||
I'm still working actively on this. This patch fixes most of the problems, but I need to find something smarter than visibility:collapse because this has an effect on our focus mechanism.
Attachment #693357 -
Attachment is obsolete: true
Assignee | ||
Updated•13 years ago
|
Attachment #693357 -
Attachment is obsolete: false
Assignee | ||
Updated•13 years ago
|
Attachment #694483 -
Attachment description: patch v2 → addendum
Attachment #694483 -
Attachment is patch: true
Updated•13 years ago
|
Component: Developer Tools → Developer Tools: Framework
Assignee | ||
Updated•13 years ago
|
Whiteboard: to land once try is green
Assignee | ||
Comment 34•13 years ago
|
||
This patches fixes the different test failures. Also, I removed the `show` mechanism, because hiding the toolbox before it's loaded causes problems in the tests that I didn't manage to fix (focus problems), and I want to get the remaining optimizations in Firefox 20.
Attachment #694483 -
Attachment is obsolete: true
Attachment #697409 -
Flags: review?(jwalker)
Assignee | ||
Comment 35•13 years ago
|
||
Comment 36•13 years ago
|
||
Comment on attachment 697409 [details] [diff] [review]
addendum
Review of attachment 697409 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/devtools/styleinspector/CssHtmlTree.jsm
@@ +61,5 @@
> * Schedule a new batch on the main loop.
> */
> schedule: function UP_schedule()
> {
> + if (this.canceled) {
I think 'canceled' is US English, 'cancelled' is UK/Ca/Au English (to the extent that English can be tied down at all). I'm ok with the change but I'm not sure that the 'll' version is actually wrong.
Attachment #697409 -
Flags: review?(jwalker) → review+
Assignee | ||
Comment 37•13 years ago
|
||
still some oranges.
Assignee | ||
Comment 38•13 years ago
|
||
Assignee | ||
Comment 39•13 years ago
|
||
I failed my push to try (pushed some old code).
https://tbpl.mozilla.org/?tree=Try&rev=6f9243cbba48
Assignee | ||
Comment 41•13 years ago
|
||
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
Comment 42•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 20
Updated•7 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•