Reduce MeanMax search space

.. to speed up extracting the mean maximals.

.. we still work at 1s intervals for very short durations
   but gradually increase to longer as the duration gets
   over an hour.

.. for almost all usage this will not make a difference to the
   values extracted since the actual values are largely rounded
   to integer values (and therefore the granularity was already
   being disposed after the search).

.. the exact durations are;

        Duration    Increment
        <120        1
        <600        2
        <1200       5
        <3600       20
        <7200       120
        >= 7200     300
This commit is contained in:
Mark Liversedge
2015-07-05 21:37:43 +01:00
parent ec893f2b7c
commit 82ddf4acaa

View File

@@ -1246,7 +1246,7 @@ MeanMaxComputer::run()
data_t *dataseries_i = integrate_series(data);
for (int i=1; i<data.points.size(); i++) {
for (int i=1; i<data.points.size();) {
int offset;
data_t c=divided_max_mean(dataseries_i,data.points.size(),i,&offset);
@@ -1261,6 +1261,14 @@ MeanMaxComputer::run()
else
ride_bests[sec] = val;
}
// increments to limit search scope
if (i<120) i++;
else if (i<600) i+= 2;
else if (i<1200) i += 5;
else if (i<3600) i += 20;
else if (i<7200) i += 120;
else i += 300;
}
free(dataseries_i);