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
}
	/**
	 * Gets the formatted string representing the best active binding for a
	 * command. The best binding is the one that would be most appropriate to
	 * show in a menu. Bindings which belong to a child scheme are given
	 * preference over those in a parent scheme. The rest of the calculaton is
	 * based most on various concepts of "length", as well as giving some
	 * modifier keys preference (e.g., <code>Alt</code> is less likely to
	 * appear than <code>Ctrl</code>).
	 * 
	 * @param commandId
	 *            The identifier of the command for which the best active
	 *            binding should be retrieved; must not be <code>null</code>.
	 * @return The formatted string for the best binding; may be
	 *         <code>null</code> if no bindings are active for the given
	 *         command.
	 * @since 3.2
	 */
	public final String getBestActiveBindingFormattedFor(final String commandId) {
		final TriggerSequence binding = getBestActiveBindingFor(commandId);
		if (binding != null) {
			return binding.format();
		}
		return null;
	}
	/**
	 * <p>
	 * Returns the set of all bindings managed by this class.
	 * </p>
	 * <p>