[sync] Fix performance problem with GitModelCache#getChildren
commit6c5a0d986b7bc84df969baea3d646e18a877b5e0
authorRobin Stocker <robin@nibor.org>
Fri, 1 Feb 2013 13:26:58 +0000 (1 14:26 +0100)
committerRobin Stocker <robin@nibor.org>
Fri, 1 Feb 2013 13:41:06 +0000 (1 14:41 +0100)
tree2bf967d6959476295badd2e5f36678f0c79609d7
parent10cdd651b8acef99b4a89a2fc5732d1043d47b5b
[sync] Fix performance problem with GitModelCache#getChildren

The problem was that it returned a child for each changed file, instead
of only the direct children. So e.g. with changes in "dir/a", "dir/b"
and "dir/c", it returned a node for "dir" three times. When the number
of changes is significant, this resulted in many children returned, each
of which also has children which will be processed by the calling code.

The code in GitModelCommit for tree construction did it right. To fix
this, this change consolidates the two tree construction implementations
into one which should be correct.

It also takes care that the final tree nodes use as little memory as
possible by using arrays.

Bug: 396209
Change-Id: I0f139cf7747affb06b32cee584355cf60b46fb76
org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTest.java
org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTreeTest.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTree.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCommit.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelTree.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTree.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/TreeBuilder.java [new file with mode: 0644]