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
* 
	 * @param listener
	 *            The listener to attach; must not be <code>null</code>.
	 */
	public final void addBindingManagerListener(
			final IBindingManagerListener listener) {
		addListenerObject(listener);
	}
	/**
	 * <p>
	 * Builds a prefix table look-up for a map of active bindings.
	 * </p>
	 * <p>
	 * This method takes <code>O(mn)</code>, where <code>m</code> is the
	 * length of the trigger sequences and <code>n</code> is the number of
	 * bindings.
	 * </p>
	 * 
	 * @param activeBindings
	 *            The map of triggers (<code>TriggerSequence</code>) to
	 *            command ids (<code>String</code>) which are currently
	 *            active. This value may be <code>null</code> if there are no
	 *            active bindings, and it may be empty. It must not be
	 *            <code>null</code>.
	 * @return A map of prefixes (<code>TriggerSequence</code>) to a map of
	 *         available completions (possibly <code>null</code>, which means
	 *         there is an exact match). The available completions is a map of
	 *         trigger (<code>TriggerSequence</code>) to command identifier (<code>String</code>).
	 *         This value will never be <code>null</code>, but may be empty.
	 */