Speed up staging view tree viewer management
commit5be233e1a7f05fd64dda12efa3128e6c13d236d3
authorThomas Wolf <thomas.wolf@paranor.ch>
Thu, 14 Jun 2018 20:39:00 +0000 (14 22:39 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 16 Jun 2018 07:45:45 +0000 (16 09:45 +0200)
tree20b5100ab0616604d406a522d794d737ab2c1d20
parent14bf1114490d509b46c49524f85e2173e339081c
Speed up staging view tree viewer management

In StagingView:

1. Don't call AbstractTreeViewer.getVisibleExpandedElements() multiple
   times. In fact, don't call it at all. We do have the tree hierarchy,
   and the tree viewer uses a hash map, so traversing the known sub-
   hierarchy explicitly is much faster.

2. Avoid duplicate paths to add (or remove) by using sets instead of
   lists.

In StagingViewContentProvider:

3. Speed up getStagingEntriesFiltered and hasVisibleChildren by
   traversing the wanted sub-hierarchy explicitly.

4. Massively reduce the number of calls to getFilterPattern().

Bug:535856
Change-Id: I86876119c58f58305e722a832f8950c913d1f2d3
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingViewContentProvider.java