Project: Eclipse_Platform_UI
Bug 184087 [ActivityMgmt] Optimize performance of MutableActivityManager#setEnabledActivityIds()
Reported: 2007-04-25 14:57:12 | Status: verified fixed

Build ID: I20070323-1616 I'd like to propose an optimization to MutableActivityManager#setEnabledActivityIds(). In the method MutableActivityManager#updateIdentifier(Identifier identifier) change the following: boolean matchesAtLeastOneEnabled = false; boolean matchesAtLeastOneDisabled = false; for (Iterator iterator = definedActivityIds.iterator(); iterator.hasNext();) { ... } To: boolean matchesAtLeastOneEnabled = false; boolean matchesAtLeastOneDisabled = false; for (Iterator iterator = definedActivityIds.iterator(); !matchesAtLeastOneEnabled && iterator.hasNext();) { ... } Since the largest chunk of time when setting activities is taken up within this for loop by checking the activity patterns, this could skip on average a large number of pattern matches.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java