From: Geneviève Bastien Date: Thu, 23 Feb 2017 20:27:18 +0000 (-0500) Subject: datastore: Fast return to for classic node children X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=75bdf96ff7e8ccbf5c3b2c8eeaa0d3a4ba2dafb8;p=deliverable%2Ftracecompass.git datastore: Fast return to for classic node children When selecting next children of classic nodes, once the node's end time is past the maximum of the range, it is no use searching the rest of the children. Change-Id: I7a1aba410718ea33a84b6a0b109121b0512fd284 Signed-off-by: Geneviève Bastien Reviewed-on: https://git.eclipse.org/r/91758 Reviewed-by: Hudson CI Reviewed-by: Loic Prieur-Drevon --- diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java index c5c610f4e7..bf209becf4 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java @@ -142,6 +142,7 @@ public class ClassicNode extends HTNode { return Collections.EMPTY_LIST; } + long end = rc.max(); List matchingChildren = new LinkedList<>(); /* Check all children except the last one */ for (int i = 0; i < nbChildren - 1; i++) { @@ -152,6 +153,9 @@ public class ClassicNode extends HTNode { if (rc.intersects(childStart, childEnd)) { matchingChildren.add(i); } + if (end <= childEnd) { + return matchingChildren; + } } /* Check the last child */