datastore: Fast return to for classic node children
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 23 Feb 2017 20:27:18 +0000 (15:27 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 2 Mar 2017 20:04:07 +0000 (15:04 -0500)
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 <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/91758
Reviewed-by: Hudson CI
Reviewed-by: Loic Prieur-Drevon <loic.prieur.drevon@ericsson.com>
statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/provisional/datastore/core/historytree/classic/ClassicNode.java

index c5c610f4e741361a98eec39e4fa440b6ac925adc..bf209becf401052d55b70c0355d645cb408e943f 100644 (file)
@@ -142,6 +142,7 @@ public class ClassicNode<E extends IHTInterval> extends HTNode<E> {
                     return Collections.EMPTY_LIST;
                 }
 
+                long end = rc.max();
                 List<Integer> 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<E extends IHTInterval> extends HTNode<E> {
                     if (rc.intersects(childStart, childEnd)) {
                         matchingChildren.add(i);
                     }
+                    if (end <= childEnd) {
+                        return matchingChildren;
+                    }
                 }
 
                 /* Check the last child */
This page took 0.025114 seconds and 5 git commands to generate.