timing.core: speed up (Lazy)ArrayList queries with binary search
authorLoïc Prieur-Drevon <loic.prieurdrevon@gmail.com>
Tue, 20 Sep 2016 16:03:05 +0000 (12:03 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 23 Sep 2016 14:36:48 +0000 (10:36 -0400)
commit2047fe0410d1acf38d85b51cadd75d31bebf2936
treea2ebb73e7f8ea0817883a11dad167901ade1dd4e
parent437de777903ca0693b593d27a791dd4186197316
timing.core: speed up (Lazy)ArrayList queries with binary search

The getIntersectingElements queries on the (Lazy)ArrayList
SegmentStore would iterate through the entire store with a
stream().filter(), whereas the store is sorted by start time,
then by end time of the segments.

By using a binary search on the store, we can narrow down the
iteration to the relevant sublist thus speeding queries up to 50%
on querying from real analyses.

Change-Id: Idb798f42571d14130acd26c0d126cc7b6cdbf04c
Signed-off-by: Loïc Prieur-Drevon <loic.prieurdrevon@gmail.com>
Reviewed-on: https://git.eclipse.org/r/81503
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/store/ArrayListStore.java
analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/store/LazyArrayListStore.java
This page took 0.024356 seconds and 5 git commands to generate.