From: Tomasz Moń Date: Mon, 22 Aug 2016 18:50:48 +0000 (+0300) Subject: Remove smallestLabelSeparation from TimeScale (#3186) X-Git-Tag: v2.2.2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c283867f73a5caea271304dd42480383ccd515ba;p=thirdparty%2FChart.js.git Remove smallestLabelSeparation from TimeScale (#3186) In case of charts with over 4000 points, smallestLabelSeparation calculation contributes significantly to total cpu usage (about 25% according to built-in Chrome profiler). Important thing to note is that result of this calculation is not used at all. Related commits: * 677c249b613bf1a4ebccb1bebda9f04f7346b866 introduced smallestLabelSeparation. It was used in calculateBaseWidth function. * d198157fb8ea479ec9286bcf0ffb72e2e62e9661 removed last use of smallestLabelSeparation. Since then the calculated value was never used. --- diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index 4e668cb67..11585bcab 100755 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -255,14 +255,6 @@ module.exports = function(Chart) { me.scaleSizeInUnits = me.lastTick.diff(me.firstTick, me.tickUnit, true); } - me.smallestLabelSeparation = me.width; - - helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) { - for (var i = 1; i < me.labelMoments[datasetIndex].length; i++) { - me.smallestLabelSeparation = Math.min(me.smallestLabelSeparation, me.labelMoments[datasetIndex][i].diff(me.labelMoments[datasetIndex][i - 1], me.tickUnit, true)); - } - }, me); - // Tick displayFormat override if (me.options.time.displayFormat) { me.displayFormat = me.options.time.displayFormat;