datastore: Add intervals without check for node read
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 16 Feb 2017 20:56:28 +0000 (15:56 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Thu, 2 Mar 2017 20:03:33 +0000 (15:03 -0500)
When nodes are read from disk, we know the intervals fit into it, there
is no need to go through the code path that checks if the interval can
go in the node.

This change alone greatly reduces the performance impact of both single
and full queries for large state system, when nodes are often read from
disk.

Change-Id: If653611b00d56b604d23ddd1f6e62bb22f822da0
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/91756
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/HTNode.java

index 0f214da215dee2c57466531631151e1624d9bcd3..3c3794b489d63150d2b35b1a1dc21cd79765637a 100644 (file)
@@ -471,7 +471,7 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
         ISafeByteBufferReader readBuffer = SafeByteBufferFactory.wrapReader(buffer, res - buffer.position());
         for (int i = 0; i < intervalCount; i++) {
             E interval = objectReader.readInterval(readBuffer);
-            newNode.add(interval);
+            newNode.addNoCheck(interval);
         }
 
         /* Assign the node's other information we have read previously */
@@ -679,6 +679,14 @@ public class HTNode<E extends IHTInterval> implements IHTNode<E> {
         }
     }
 
+    /**
+     * Directly add the interval to the node, without check. This method is
+     * package private because only the read method should make use of it.
+     */
+    void addNoCheck(E newInterval) {
+        fIntervals.add(newInterval);
+    }
+
     @Override
     public Iterable<E> getMatchingIntervals(TimeRangeCondition timeCondition,
             Predicate<E> extraPredicate) {
This page took 0.026726 seconds and 5 git commands to generate.