Optimize searching further

There are now 3 code paths in decreasing speed:

First, optimize subsearching more by just hiding the actors
that didn't match, since we know the ordering has to be right.

For initiating a search (or backspacing an existing one), again
instead of destroying and recreating actors, just temporarily
remove them and re-add them in the desired order.

Finally for when data has changed, use the old code path of
destroying all actors.  (This itself could obviously be optimized
if we had a way to know that just one application changed, but
at the moment we don't).

https://bugzilla.gnome.org/show_bug.cgi?id=596119
This commit is contained in:
Colin Walters
2009-09-24 18:36:36 -04:00
parent 1da4837d98
commit 159081dcfc
3 changed files with 142 additions and 103 deletions

View File

@ -197,17 +197,17 @@ AppDisplay.prototype = {
this._appsStale = true;
this._appSystem.connect('installed-changed', Lang.bind(this, function(appSys) {
this._appsStale = true;
this._redisplay(false);
this._redisplay(0);
this._redisplayMenus();
}));
this._appSystem.connect('favorites-changed', Lang.bind(this, function(appSys) {
this._redisplay(false);
this._redisplay(0);
}));
this._appMonitor.connect('app-added', Lang.bind(this, function(monitor) {
this._redisplay(false);
this._redisplay(0);
}));
this._appMonitor.connect('app-removed', Lang.bind(this, function(monitor) {
this._redisplay(false);
this._redisplay(0);
}));
// Load the apps now so it doesn't slow down the first
@ -338,7 +338,7 @@ AppDisplay.prototype = {
// Gets information about all applications by calling Gio.app_info_get_all().
_refreshCache : function() {
if (!this._appsStale)
return;
return true;
this._allItems = {};
this._appCategories = {};
@ -371,11 +371,13 @@ AppDisplay.prototype = {
}
this._appsStale = false;
return false;
},
// Stub this out; the app display always has a category selected
_setDefaultList : function() {
this._matchedItems = [];
this._matchedItems = {};
this._matchedItemKeys = [];
},
// Compares items associated with the item ids based on the alphabetical order