Improve scale() performance

This commit is contained in:
Alexander Zobnin
2017-06-26 12:23:04 +03:00
parent f095053ba5
commit 007ddbf72f
11 changed files with 67 additions and 5 deletions

View File

@@ -169,6 +169,17 @@ function scale(datapoints, factor) {
});
}
function scale_perf(datapoints, factor) {
for (let i = 0; i < datapoints.length; i++) {
datapoints[i] = [
datapoints[i][POINT_VALUE] * factor,
datapoints[i][POINT_TIMESTAMP]
];
}
return datapoints;
}
/**
* Simple delta. Calculate value delta between points.
* @param {*} datapoints
@@ -327,6 +338,7 @@ const exportedFunctions = {
groupBy_perf,
sumSeries,
scale,
scale_perf,
delta,
rate,
SUM,