MeasurementCluster's addToSeries is slow
[WebKit-https.git] / Websites / perf.webkit.org / public / v3 / models / measurement-cluster.js
1 'use strict';
2
3 class MeasurementCluster {
4     constructor(response)
5     {
6         this._response = response;
7         this._adaptor = new MeasurementAdaptor(response['formatMap']);
8     }
9
10     startTime() { return this._response['startTime']; }
11     endTime() { return this._response['endTime']; }
12
13     addToSeries(series, configType, includeOutliers, idMap)
14     {
15         var rawMeasurements = this._response['configurations'][configType];
16         if (!rawMeasurements)
17             return;
18
19         var self = this;
20         for (var row of rawMeasurements) {
21             var point = this._adaptor.applyTo(row);
22             if (point.id in idMap || (!includeOutliers && point.isOutlier))
23                 continue;
24             idMap[point.id] = true;
25             point.cluster = this;
26             series.append(point);
27         }
28     }
29 }
30
31 if (typeof module != 'undefined')
32     module.exports.MeasurementCluster = MeasurementCluster;