Bug 144396 - DiagramEventBroker.NotifierToKeyToListenersSetMap creates HashMap and HashSet which in most scenario are only having 1 or 2 entries.
Summary: DiagramEventBroker.NotifierToKeyToListenersSetMap creates HashMap and HashSet...
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: ---   Edit
Assignee: Mohammed Mostafa CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2006-05-30 05:07 EDT by Maneesh CLA
Modified: 2006-06-05 14:32 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maneesh CLA 2006-05-30 05:07:09 EDT
In the implementation of NotifierToKeyToListenersSetMap.addListener
        public void addListener(EObject notifier, Object key, Object listener) {
            Map keys = (Map) listenersMap.get(notifier);
            if (keys == null) {
                keys = new HashMap();
                listenersMap.put(notifier, keys);
            }
            Set listenersSet = (Set) keys.get(key);
            if (listenersSet == null) {
                listenersSet = new HashSet();
                keys.put(key, listenersSet);
            }
            listenersSet.add(listener);
        }

By using initial size of 4 for both HashMap and HashSet, reduces the retained size of memory in one scenario from 
	3,138,288 to 2,416,736 bytes.
Comment 1 Mohammed Mostafa CLA 2006-06-05 14:32:41 EDT
Fixed
Comment 2 Eclipse Webmaster CLA 2010-07-19 12:30:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug