Closed
Bug 895778
Opened 12 years ago
Closed 11 years ago
Optimize code path of CustomizableUIInternal.registerToolbar
Categories
(Firefox :: Toolbars and Customization, defect)
Firefox
Toolbars and Customization
Tracking
()
RESOLVED
FIXED
Firefox 28
People
(Reporter: jaws, Assigned: jaws)
References
Details
(Whiteboard: [Australis:M8])
Attachments
(1 file, 1 obsolete file)
7.12 KB,
patch
|
Gijs
:
review+
mconley
:
review+
|
Details | Diff | Splinter Review |
My homegrown profiler has shown that registerToolbar is the worst offender of CustomizableUIInternal when opening windows in tpaint.
The attached patch folds some calls to hasAttribute/getAttribute. It also removes isBuildAreaRegistered because the registerBuildArea already protects against a pre-registered build area.
While here I noticed that the aContainer argument of setLocationAttributes is unused so I killed it with fire.
Baseline try push:
https://tbpl.mozilla.org/?tree=Try&rev=9f4f2e41cc7c
With patch:
https://tbpl.mozilla.org/?tree=Try&rev=e527965b8891
Attachment #778329 -
Flags: review?(mnoorenberghe+bmo)
Comment 1•12 years ago
|
||
Comment on attachment 778329 [details] [diff] [review]
registerToolbar.patch
Review of attachment 778329 [details] [diff] [review]:
-----------------------------------------------------------------
Driveby feedback - sorry. Looks good, but I have some suggestions/comments...
::: browser/components/customizableui/src/CustomizableUI.jsm
@@ -474,5 @@
> registerMenuPanel: function(aPanel) {
> - if (this.isBuildAreaRegistered(CustomizableUI.AREA_PANEL, aPanel)) {
> - return;
> - }
> -
Actually, this function gets called whenever the menupanel is opened (ensureRegistered in panelUI is called). Executing all the rest of this function every time seems senseless. If this case of running it twice is not an issue for toolbars, excellent, but then let's move the code here, or to panelUI, so we don't do this more than once...
@@ +1737,3 @@
> let parent = aElement.parentNode;
> + let parentFlex = parseInt(parent.getAttribute("flex") || 0, 10);
> + elementFlex = parseInt(elementFlex, 10);
This will be NaN if add-ons put bogus values in the attribute. Should we use || 0 to care about that?
Also, if we're going for speed, you can just coerce the string value rather than using parseInt (which is slower because it can also deal with "123junk" rather than just "123").
Attachment #778329 -
Flags: feedback+
Assignee | ||
Comment 2•12 years ago
|
||
Gijs: Thank you for the feedback!
I've updated the patch to use type coercion instead of parseInt and sent it tryserver (also including mochitest-bc), https://tbpl.mozilla.org/?tree=Try&rev=e68904b42bcd
Attachment #778329 -
Attachment is obsolete: true
Attachment #778329 -
Flags: review?(mnoorenberghe+bmo)
Attachment #778678 -
Flags: review?(mnoorenberghe+bmo)
Assignee | ||
Comment 3•12 years ago
|
||
I failed on getting mochitest-bc tests to run because I screw up the syntax for the try push. Repushed to try server to just run the mochitest-browser-chrome test suite, https://tbpl.mozilla.org/?tree=Try&rev=1bcde58db628
Assignee | ||
Updated•12 years ago
|
Attachment #778678 -
Flags: review?(gijskruitbosch+bugs)
Comment 4•12 years ago
|
||
Comment on attachment 778678 [details] [diff] [review]
895778.patch
Review of attachment 778678 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM.
Attachment #778678 -
Flags: review?(gijskruitbosch+bugs) → review+
Comment 5•12 years ago
|
||
Comment on attachment 778678 [details] [diff] [review]
895778.patch
Gijs knows this code better than me.
Attachment #778678 -
Flags: review?(mnoorenberghe+bmo)
Comment 6•12 years ago
|
||
Comment on attachment 778678 [details] [diff] [review]
895778.patch
Review of attachment 778678 [details] [diff] [review]:
-----------------------------------------------------------------
Ditto!
Attachment #778678 -
Flags: review+
Assignee | ||
Comment 7•12 years ago
|
||
Whiteboard: [Australis:M8][fixed-in-ux]
Comment 8•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [Australis:M8][fixed-in-ux] → [Australis:M8]
Target Milestone: --- → Firefox 28
You need to log in
before you can comment on or make changes to this bug.
Description
•