Closed Bug 394695 Opened 17 years ago Closed 17 years ago

Places rebuilds lots of stuff on every command update

Categories

(Firefox :: Bookmarks & History, defect, P2)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
Firefox 3 beta1

People

(Reporter: bzbarsky, Assigned: asaf)

References

Details

(Keywords: perf)

Attachments

(1 file)

See comments in bug 352394.  It would be nice to not rebuild places UI stuff just because a command for a textfield on the page somewhere got updated.
Flags: blocking-firefox3?
Keywords: perf
Priority: -- → P2
Target Milestone: --- → Firefox 3 M9
Attachment #281345 - Flags: review?(dietrich)
Assignee: nobody → mano
Comment on attachment 281345 [details] [diff] [review]
cache insertionpoints, flavors and controllers

r=me, a couple of nits below

> 
>           var orientation = NHRVO.DROP_AFTER;
>           // If there is no selection, insert at the end of the container. 
>           if (!this.hasSelection) {
>             var index = this.view.rowCount - 1;
>-            return this._getInsertionPoint(index, orientation);
>+            return this._cachedInsertionPoint = this._getInsertionPoint(index, orientation);

nit: line length

>@@ -479,17 +485,17 @@
>           // If the sole selection is the bookmarks toolbar folder, we insert
>           // into it even if it is not opened
>           if (this.hasSingleSelection && resultView.isContainer(max.value) &&
>               (resultView.isContainerOpen(max.value) ||
>                resultView.nodeForTreeIndex(max.value)
>                          .itemId == PlacesUtils.bookmarksRootId))
>             orientation = NHRVO.DROP_ON;
> 
>-          return this._getInsertionPoint(max.value, orientation);
>+          return this._cachedInsertionPoint = this._getInsertionPoint(max.value, orientation);

ditto

>@@ -987,21 +993,25 @@
> 
>       <method name="destroyContextMenu">
>         <parameter name="aPopup"/>
>         <body/>
>       </method>
>     </implementation>
>     <handlers>
>       <handler event="focus"><![CDATA[
>+        this._cachedInsertionPoint = undefined;
>+
>         // See select handler. We need the sidebar's places commandset to be
>         // updated as well
>         document.commandDispatcher.updateCommands("focus");
>       ]]></handler>
>       <handler event="select"><![CDATA[
>+        this._cachedInsertionPoint = undefined;
>+        

nit: whitespace
Attachment #281345 - Flags: review?(dietrich) → review+
Attachment #281345 - Flags: approval1.9?
Boris: I kinda don't understand the initial bug though, we update our commands on-event, not on-commmand. Places-specific commands are updated on focus-change and on explicit tree-selection (in a places-tree, that is). That said, Edit & Clipboard commands are also supported by PlacesController and are updated on-selection-change (in addition to on-focus).
> we update our commands on-event, not on-commmand

I was seeing places code update its stuff every time selection changed in any text input in the page when I filed this bug.  These changes were consuming a lot of tiem.  Perhaps that's no longer the case.  I'd have to do some retesting to see, and I'm not really sure it's worth it.
Oh, figures, the old places-commandupdater used to track "select" events. Do you mind if I morph this bug to cover other optimizations?
Go for it.
Attachment #281345 - Flags: approval1.9? → approval1.9+
mozilla/browser/components/places/content/controller.js 1.180
mozilla/browser/components/places/content/menu.xml 1.84
mozilla/browser/components/places/content/toolbar.xml 1.103
mozilla/browser/components/places/content/tree.xml 1.82
mozilla/browser/components/places/content/utils.js 1.65
Flags: blocking-firefox3? → blocking-firefox3+
Mano, is this fixed?
very likely ;)
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h".

In Thunderbird 3.0b, you do that as follows:
Tools | Message Filters
Make sure the correct account is selected. Click "New"
Conditions: Body   contains   places-to-b-and-h
Change the action to "Delete Message".
Select "Manually Run" from the dropdown at the top.
Click OK.

Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter.

Gerv
Component: Places → Bookmarks & History
QA Contact: places → bookmarks
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: