Bug 318633 Part/editor switching is very slow
Build Identifier: I20100630-1856 Switching between editors and parts is very slow (tested on a Core 2 T5600 under Windows 7). Delay is about 2 seconds. I did a quick analysis with the YourKit Java Profiler. Here is what I did: 1. Open two text files (almost empty) 2. Start the profiler 3. Switch from one editor to the other 4. Stop the profiler Thus, there was only a single focus transfer. The results are (see also attached screenshots): Most of the time is consumed by the invocation of java.lang.reflect.Method.getParameterAnnotations(). For a single focus transfer, this method is called several thousand times. The back traces show that these inovations come from the setId() and setClassname() methods in the PartRenderingEngine, which in turn gets called on part activation (WBWRenderer.trackActivePart(...)). Unfortunately, I cannot tell which method in the stack trace actually causes these many invations, because the invocation counts in the profiler are not shown (for some unknown reason). Is there a way to reduce this high count of invocations? This would greatly improve the editor switching time. Reproducible: Always
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/SWTPartRenderer.java
return null;
	}
	/**
	 * Calculates the index of the element in terms of the other <b>rendered</b>
	 * elements. This is useful when 'inserting' elements in the middle of
	 * existing, rendered parents.
	 * 
	 * @param element
	 *            The element to get the index for
	 * @return The visible index or -1 if the element is not a child of the
	 *         parent
	 */
	protected int calcVisibleIndex(MUIElement element) {
		MElementContainer<MUIElement> parent = element.getParent();
		int curIndex = 0;
		for (MUIElement child : parent.getChildren()) {
			if (child == element) {
				return curIndex;
			}
			if (child.getWidget() != null)
				curIndex++;
		}
		return -1;
	}
	protected int calcIndex(MUIElement element) {
		MElementContainer<MUIElement> parent = element.getParent();
		return parent.getChildren().indexOf(element);
	}
	/*
	 * (non-Javadoc)