| author | Thomas Wolf | 2012-09-18 11:15:31 (EDT) |
|---|---|---|
| committer | John Arthorne | 2012-09-18 11:15:31 (EDT) |
| commit | 1ee7648e5251c89243cc020a6f22e0cf3d1b73cb (patch) (side-by-side diff) | |
| tree | c54ee7aafe5b3829991aa61f60cde7d0f681262f | |
| parent | d538765d1c5f469e7c1153bdaa97979122bfbad6 (diff) | |
| download | eclipse.platform.resources-1ee7648e5251c89243cc020a6f22e0cf3d1b73cb.zip eclipse.platform.resources-1ee7648e5251c89243cc020a6f22e0cf3d1b73cb.tar.gz eclipse.platform.resources-1ee7648e5251c89243cc020a6f22e0cf3d1b73cb.tar.bz2 | |
bug 389281 - fixing a minor oversight in a conditionv20120918-151531I20121002-0800I20120925-0800I20120920-1300I20120919-2000I20120919-0800I20120919-0330I20120918-2200I20120918-2000
| -rw-r--r-- | bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java index a47225a..86183c2 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/dtree/AbstractDataTreeNode.java @@ -93,11 +93,12 @@ public abstract class AbstractDataTreeNode { int resultIndex = 0; while (oldIndex < oldNodes.length && newIndex < newNodes.length) { int log2 = 31 - Integer.numberOfLeadingZeros(oldNodes.length - oldIndex); - if (log2 > 1 && newNodes.length < (oldNodes.length - oldIndex) / log2) { + if (log2 > 1 && (newNodes.length - newIndex) <= (oldNodes.length - oldIndex) / log2) { // We can expect to fare better using binary search. In particular, this will optimize the case of a folder refresh (new linked // folder with many files in a flat hierarchy), where this is called repeatedly, with oldNodes containing the files added so far, // and newNodes containing exactly one new node for the next file to be added. The old algorithm has quadratic performance - // (O((n+1)*n/2); number of string comparisons is the dominating component here), this new algorithm is O(n*log(n)). + // (O((n+1)*n/2); number of string comparisons is the dominating component here) in this case; this new algorithm does O(n*log(n)) + // string comparisons. String key = newNodes[newIndex].name; // Figure out where to insert the next new node. int left = oldIndex; |

