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 700194 - MessageTray: improve complexity of operations on sources
MessageTray: improve complexity of operations on sources
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: message-tray
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2013-05-12 18:18 UTC by Giovanni Campagna
Modified: 2013-05-12 19:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Hash: make .size() constant time (1.43 KB, patch)
2013-05-12 18:18 UTC, Giovanni Campagna
committed Details | Review
MessageTray: don't list the sources all the time (2.39 KB, patch)
2013-05-12 18:18 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2013-05-12 18:18:03 UTC
Let's avoid linear time, if we can.
Comment 1 Giovanni Campagna 2013-05-12 18:18:07 UTC
Created attachment 243942 [details] [review]
Hash: make .size() constant time

MessageTray calls .size() very often to update the no messages label,
so a linear time implementation is not good enough.
Comment 2 Giovanni Campagna 2013-05-12 18:18:11 UTC
Created attachment 243943 [details] [review]
MessageTray: don't list the sources all the time

The point of a hash table is that you don't need to list all the
elements. To avoid that, keep a "clearableCount" in MessageTray,
which can be used by the message tray menu to show and hide the
clear item, and that is updated in constant time when sources
are added or removed.
Comment 3 Jasper St. Pierre (not reading bugmail) 2013-05-12 18:33:59 UTC
Review of attachment 243942 [details] [review]:

OK.
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-05-12 18:35:05 UTC
Review of attachment 243943 [details] [review]:

OK.
Comment 5 Giovanni Campagna 2013-05-12 19:07:07 UTC
Attachment 243942 [details] pushed as b0dc841 - Hash: make .size() constant time
Attachment 243943 [details] pushed as fa44dc7 - MessageTray: don't list the sources all the time