Skip to content

Commit

Permalink
Reordering decimation clean to avoid allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico-DF committed Apr 12, 2021
1 parent 5b3f260 commit 4bd7e87
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/plugins/plugin.decimation.js
Expand Up @@ -233,6 +233,13 @@ export default {
return;
}

let {start, count} = getStartAndCountOfVisiblePointsSimplified(meta, data);
if (count <= 4 * availableWidth) {
// No decimation is required until we are above this threshold
cleanDecimatedDataset(dataset);
return;
}

if (isNullOrUndef(_data)) {
// First time we are seeing this dataset
// We override the 'data' property with a setter that stores the
Expand All @@ -251,13 +258,6 @@ export default {
});
}

let {start, count} = getStartAndCountOfVisiblePointsSimplified(meta, data);
if (count <= 4 * availableWidth) {
// No decimation is required until we are above this threshold
cleanDecimatedDataset(dataset);
return;
}

// Point the chart to the decimated data
let decimated;
switch (options.algorithm) {
Expand Down

0 comments on commit 4bd7e87

Please sign in to comment.