GNOME Bugzilla – Bug 700194
MessageTray: improve complexity of operations on sources
Last modified: 2013-05-12 19:07:17 UTC
Let's avoid linear time, if we can.
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.
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.
Review of attachment 243942 [details] [review]: OK.
Review of attachment 243943 [details] [review]: OK.
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