Bug 565061 - TreeView performance optimization in removeAll()
Summary: TreeView performance optimization in removeAll()
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.17 M3   Edit
Assignee: Carsten Hammer CLA
QA Contact: Alexandr Miloslavskiy CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 563542
  Show dependency tree
 
Reported: 2020-07-08 14:52 EDT by Carsten Hammer CLA
Modified: 2020-08-18 13:29 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Hammer CLA 2020-07-08 14:52:06 EDT
In Bug 549171 it has been explained how to improve performance for bulk insert and deletion. One part of this optimization can be taken over as generic approach. That is the setRedraw(false) call within removeAll() of a TreeView.
As the cost of the forced redraw for small amounts of elements outweights the saved calls within the loop we should stay away from this optimization for a number of elements below 30. This is an estimation based on some tests using Bug548982_TreeAddRemoveMany.java using some different values for NUM_ITEMS.
Comment 1 Alexandr Miloslavskiy CLA 2020-07-08 15:21:04 EDT
I expect to merge this patch tomorrow.

By the way, can you please tell which problem are you solving? Is this a problem in Eclipse or some other SWT based software?
Comment 3 Alexandr Miloslavskiy CLA 2020-07-15 15:21:56 EDT
In master now.

Carsten, thanks for working on this!
Comment 4 Alexandr Miloslavskiy CLA 2020-07-15 15:23:18 EDT
Carsten, if by chance you're willing to do more improvements here, I know how to improve performance of 'TreeItem.removeAll()' a lot more - by using `TVE_COLLAPSERESET`.

If you're willing to implement that, it would be great!
Comment 5 Lars Vogel CLA 2020-07-20 08:26:07 EDT
Thanks Carsten.
Comment 6 Carsten Hammer CLA 2020-07-21 16:04:52 EDT
(In reply to Alexandr Miloslavskiy from comment #4)
> Carsten, if by chance you're willing to do more improvements here, I know
> how to improve performance of 'TreeItem.removeAll()' a lot more - by using
> `TVE_COLLAPSERESET`.
> 
> If you're willing to implement that, it would be great!

Thanks for your support! I guess I first have to understand a few components a little bit better.
Comment 7 Alexandr Miloslavskiy CLA 2020-08-18 13:29:08 EDT
Verified in I20200818-0900 (using test snippet 'Bug548982_TreeAddRemoveMany'):

The patch works as expected. When user's code does not explicitly request
`setRedraw(false)`, there is roughly a 3x speedup (11771ms -> 3653ms) for
`TreeItem.removeAll()` with 20000 child items.