After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 645313 - improve search time
improve search time
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 645334 645363 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-03-20 16:47 UTC by Maxim Ermilov
Modified: 2011-03-21 23:52 UTC
See Also:
GNOME target: 3.0
GNOME version: ---


Attachments
searchDisplay: don't create useless SearchResult's (3.00 KB, patch)
2011-03-20 16:47 UTC, Maxim Ermilov
reviewed Details | Review
iconGrid: remove unused variable in _computeLayout (773 bytes, patch)
2011-03-21 21:49 UTC, Maxim Ermilov
committed Details | Review
searchDisplay: don't create useless SearchResult's (3.07 KB, patch)
2011-03-21 21:50 UTC, Maxim Ermilov
none Details | Review
searchDisplay: don't create useless SearchResult's (3.31 KB, patch)
2011-03-21 22:54 UTC, Maxim Ermilov
committed Details | Review

Description Maxim Ermilov 2011-03-20 16:47:53 UTC
Created attachment 183848 [details] [review]
searchDisplay: don't create useless SearchResult's

average constructing time for 1 SearchResult is 3 ms.
It give > 400 result on query like 'a' (on my machine).
Comment 1 Maxim Ermilov 2011-03-20 21:33:36 UTC
test:

query | without patch | with patch
'a'   |      2.9 sec  |     0.5 sec
'e'   |      2.2 sec  |     0.45 sec
Comment 2 Maxim Ermilov 2011-03-21 00:26:11 UTC
*** Bug 645334 has been marked as a duplicate of this bug. ***
Comment 3 Florian Müllner 2011-03-21 08:34:04 UTC
*** Bug 645363 has been marked as a duplicate of this bug. ***
Comment 4 John Stowers 2011-03-21 08:52:45 UTC
Just tested this, amazing performance improvement (even on queries with less < 400 results)

This single patch has improved my shell experience considerably.
Comment 5 Dan Winship 2011-03-21 21:10:34 UTC
Comment on attachment 183848 [details] [review]
searchDisplay: don't create useless SearchResult's

>+        this._notDisplayedResult = results.slice(0);
>+        this._terms = terms.slice(0);

Is it actually necessary to copy the lists? It looks like nothing ever mutates them...

If so, please at least add a comment "// copy the lists", since the ".slice(0)" idiom isn't immediately obvious.

either way, good to commit
Comment 6 Colin Walters 2011-03-21 21:12:59 UTC
Review of attachment 183848 [details] [review]:

I agree we have a big search performance problem right now, but less certain about this patch; see my comment below.

What if we changed iconGrid.js to create actors lazily?  Basically we do:

this._grid.addItemPromise(Lang.bind(this, function () { return new SearchResult(this.provider, meta, terms); }));

Then the grid consumes them as needed.  So inside icongrid.js, we'd have a _lazyChildren variable which would be a list of functions.  The tricky thing would be - I'm not sure if clutter is going to be happy with us calling _add_actor() from inside allocate.  Maybe we queue it to a timeout?

::: js/ui/iconGrid.js
@@ -284,2 @@
     _computeLayout: function (forWidth) {
-        let children = this._grid.get_children();

This is an independent fix; let's commit it now.

::: js/ui/searchDisplay.js
@@ +111,3 @@
+        this.actor.connect('notify::width', Lang.bind(this, function() {
+            this._width = this.actor.width;
+            this._tryAddResults();

I don't like the recursion here; the first time we get allocated, this is going to fire, and then we potentially add something to a child, which in turn will cause a width notification.
Comment 7 Maxim Ermilov 2011-03-21 21:49:53 UTC
Created attachment 184013 [details] [review]
iconGrid: remove unused variable in _computeLayout
Comment 8 Maxim Ermilov 2011-03-21 21:50:56 UTC
Created attachment 184014 [details] [review]
searchDisplay: don't create useless SearchResult's

> Is it actually necessary to copy the lists?
yes

> What if we changed iconGrid.js to create actors lazily?
It will be used only here.

> I'm not sure if clutter is going to be happy with us calling _add_actor() from inside allocate.
It will print warning.

> I don't like the recursion here;
fixed
Comment 9 Maxim Ermilov 2011-03-21 22:54:36 UTC
Created attachment 184020 [details] [review]
searchDisplay: don't create useless SearchResult's

(add missing import)
Comment 10 Colin Walters 2011-03-21 23:34:02 UTC
Review of attachment 184020 [details] [review]:

It's not beautiful but the only alternative I had of changing icongrid.js isn't substantially better.  Let's go with it then.