Bug 253773 [Viewers] Collapsed expandable nodes in a TreeViewer are needlessly expensive
In the Expressions view, the debug platform TreeViewer needlessly causes the model to be queried for all children of collapsed expandable items. This can have serious performance repercussions. This can be easily seen in a CDT gdb debug session. Create a simple C project with the following main(). Launch a debug session and add 'arr1' and 'arr2' in the Expressions view. Don't expand them. Simple step through the loop. Every step takes about 3-4 seconds on a relatively fast machine. Close the Expressions view, stepping becomes instantaneous. int main() { int arr1[100]; int arr2[100]; while (1) { int i = 1; i++; } return arr1[0] + arr2[0]; }
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
*
	 * @since 3.2
	 */
	public void setChildCount(final Object elementOrTreePath, final int count) {
		if (checkBusy())
			return;
		preservingSelection(new Runnable() {
			public void run() {
				if (internalIsInputOrEmptyPath(elementOrTreePath)) {
					getTree().setItemCount(count);
					return;
				}
				Widget[] items = internalFindItems(elementOrTreePath);
				for (int i = 0; i < items.length; i++) {
					TreeItem treeItem = (TreeItem) items[i];
					treeItem.setItemCount(count);
				}
			}
		});
	}
	/**
	 * For a TreeViewer with a tree with the VIRTUAL style bit set, replace the
	 * given parent's child at index with the given element. If the given parent
	 * is this viewer's input or an empty tree path, this will replace the root
	 * element at the given index.
	 * <p>
	 * This method should be called by implementers of ILazyTreeContentProvider
	 * to populate this viewer.
	 * </p>
	 *