Speed up the RepositoriesViewContentProvider
commit71cc0b751951f2532ef89a28de9a9f167d0014dd
authorThomas Wolf <thomas.wolf@paranor.ch>
Sun, 13 May 2018 13:11:32 +0000 (13 15:11 +0200)
committerThomas Wolf <thomas.wolf@paranor.ch>
Sun, 13 May 2018 13:45:19 +0000 (13 15:45 +0200)
tree5f215a39aa312c0462b06c1fba17f2dcb8cba24a
parentc22876571babdcb97f4719d888db2e82b55cbb64
Speed up the RepositoriesViewContentProvider

Some enhancements for the working tree part:

* It's not necessary to sort in the content provider since we have a
  RepositoriesViewSorter. Besides, that sorting was very inefficient
  because it repeatedly queried File.isDirectory(), which is an
  expensive call on Windows.
* Short-cut the hasChildren() call for files and folders. This gives
  a significant speedup for large directories; the old implementation
  actually read the whole directory for a folder, but using a
  DirectoryStream we can stop reading after the first entry.
* Use Files.walkFileTree() with depth 1 to get the children and their
  attributes in one go on Windows. On Linux, this shouldn't make any
  difference; there'll be one call to get file attributes to determine
  isDirectory() anyway, but on Windows, this saves an extra call to
  getAttributes() per child.

Change-Id: Ie0bf1d89167f4399f72e4f9372aeea3dff24a320
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewContentProvider.java