MeasurementCluster's addToSeries is slow
https://bugs.webkit.org/show_bug.cgi?id=160581
Rubber-stamped by Chris Dumez.
The bulk of time was spent in MeasurementAdaptor.prototype.applyTo where we computed the interval.
Since some of data points are filtered out by TimeSeriesChart component before intervals are used,
we can significantly reduce the CPU time by lazily compute them. This patch reduces the runtime of
applyTo from ~60ms to ~30ms on my machine.
* public/v3/models/measurement-adaptor.js:
(MeasurementAdaptor.prototype.applyTo): Lazily compute and cache the interval. Also cache the build
object instead of always creating a new object.
* public/v3/models/measurement-cluster.js:
(MeasurementCluster.prototype.addToSeries): Call applyTo first before checking whether the point is
an outlier or its id to avoid extracting those values twice since they show up in the profiler. Also
use "of" instead "forEach" since "of" seems to be faster here.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@204187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
3 files changed