Community
Participate
Working Groups
Build Identifier: I20080617-2000 The following code in updateChildren of AbstractTreeViewer disposes the unwanted items starting from first item to last item. int min = Math.min(elementChildren.length, items.length); // dispose of surplus items, optimizing for the case where elements have // been deleted but not reordered, or all elements have been removed. int numItemsToDispose = items.length - min; if (numItemsToDispose > 0) { CustomHashtable children = newHashtable(elementChildren.length * 2); for (int i = 0; i < elementChildren.length; i++) { Object elementChild = elementChildren[i]; children.put(elementChild, elementChild); } int i = 0; while (numItemsToDispose > 0 && i < items.length) { Object data = items[i].getData(); if (data == null || items.length - i <= numItemsToDispose || !children.containsKey(data)) { if (data != null) { disassociate(items[i]); } items[i].dispose(); if (i + 1 < items.length) { // The components at positions i+1 through // items.length-1 in the source array are copied into // positions i through items.length-2 System.arraycopy(items, i + 1, items, i, items.length - (i+1)); } numItemsToDispose--; } else { i++; } } } I am using Nebula Grid which removes an item from items arraylist upon dispose of the item. Since the above code disposes items starting from first to last, the removal of item from items arraylist is time consuming for grid with more than 50,000 items as the remove operation has to move the remaining items in the arraylist when first time in the arraylist is removed. Instead if the AbstractTreeViewer's updateChildren code is modified to dispose the item starting from last item to first item when the remove need not have to unnecessarily do lot of move operation. This change would improve performance of filter feature significantly (from 10 sec to 1 sec for 50,000 items). I have not analyzed the impact that could happen in SWT Tree or TreeViewer based on this change. Reproducible: Always Steps to Reproduce: 1. Create a Tree with 50,000 items 2. Apply filter feature such that less number of items remain filtered 3. Observe the performance of the tree.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the stalebug whiteboard tag.