Bug 212881

Summary: [Viewers] Faster add() required for AbstractTreeViewer
Product: [Eclipse Project] Platform Reporter: Serge Beauchamp <sergebeauchamp>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: bpasero, tom.schindl
Version: 3.4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 212882    
Attachments:
Description Flags
Diff file for AbstractTreeViewer that contains the change required to support add() with elements already filtered and sorted none

Description Serge Beauchamp CLA 2007-12-13 09:35:53 EST
Our product is populating a TreeViewer with several thousands rows.  

In order to improve performance, we are able to build the object structure, filter it and sort it in a background thread, and then call AbstractTreeViewer().add(Object parentElementOrTreePath, Object[] childElements)) in the UI thread to add the children in the TreeViewer.

Unfortunately, the implementation of AbstractTreeViewer().add() performs another redundant filter and sort of the elements, which end up being quite time consuming when 15k elements are passed.

In order to solve the problem, we have been making changes to org.eclipse.jface.viewers. AbstractTreeViewer to support adding children by adding another method to the class:

public void addFilteredAndSorted(Object parentElementOrTreePath, Object[] childElements);

Which does the same task as the add() implementation, but skips the additional filtering and sorting.

In our tests, this change (and other) improve the performance of adding the new elements into the view by 50%.
Comment 1 Serge Beauchamp CLA 2007-12-13 09:37:19 EST
Created attachment 85179 [details]
Diff file for AbstractTreeViewer that contains the change required to support add() with elements already filtered and sorted

Diff file for org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
Comment 2 Boris Bokowski CLA 2007-12-13 11:17:32 EST
Thanks for the contribution. I am reluctant to add this to our codebase without any tests - would you be able to provide JUnit test cases for the new functionality? See also http://wiki.eclipse.org/Platform_UI/How_to_Contribute
Comment 3 Boris Bokowski CLA 2009-11-26 09:48:20 EST
Hitesh is now responsible for watching bugs in the [Viewers] component area.
Comment 4 Eclipse Webmaster CLA 2019-09-06 15:35:38 EDT
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.