Bug 136763 Performance improvements to BindingManager
Build id: I20060413-0010 One of our performance tests that still shows significant regression is opening editors. With profiling I found that 0.8% of that time is in Collections.unmodifiableMap(...) called by three methods in BindingManager. Another 0.15% is from instantiating new TrigerSequence[0] in three locations in BindingManager. In the first case, the creation of an immutable map is completely unnecessary - the methods are private, the maps are never exposed across API boundaries, and there is never any risk that the maps will be modified. The creation of empty TriggerSequence arrays can also be avoided with a singleton. I will attach a patch that collectively saves about 1% of the total editor startup time (elapsed time as measured by sampling profiler). These are very simple and safe fixes that I recommend considering for RC2.
bundles/org.eclipse.jface/src/org/eclipse/jface/bindings/BindingManager.java
/**
	 * The array of all bindings currently handled by this manager. This array
	 * is the raw list of bindings, as provided to this manager. This value may
	 * be <code>null</code> if there are no bindings. The size of this array
	 * is not necessarily the number of bindings.
	 */
	private Binding[] bindings = null;
	/**
	 * A cache of the bindings previously computed by this manager. This value
	 * may be empty, but it is never <code>null</code>. This is a map of
	 * <code>CachedBindingSet</code> to <code>CachedBindingSet</code>.
	 */
	private Map cachedBindings = new HashMap();
	/**
	 * The command manager for this binding manager. This manager is only needed
	 * for the <code>getActiveBindingsFor(String)</code> method. This value is
	 * guaranteed to never be <code>null</code>.
	 */
	private final CommandManager commandManager;
	/**
	 * The context manager for this binding manager. For a binding manager to
	 * function, it needs to listen for changes to the contexts. This value is
	 * guaranteed to never be <code>null</code>.
	 */
	private final ContextManager contextManager;
	/**
	 * The locale for this manager. This defaults to the current locale. The
	 * value will never be <code>null</code>.
	 */
	private String locale = Locale.getDefault().toString();