From: Mathias Küsel Date: Sat, 27 Feb 2016 16:19:33 +0000 (+0100) Subject: Much faster cache clean up X-Git-Tag: v2.0.0~32^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2066%2Fhead;p=thirdparty%2FChart.js.git Much faster cache clean up --- diff --git a/src/core/core.helpers.js b/src/core/core.helpers.js index 418cbc9f0..99ff72e2c 100644 --- a/src/core/core.helpers.js +++ b/src/core/core.helpers.js @@ -799,9 +799,9 @@ module.exports = function(Chart) { var gcLen = cache.garbageCollect.length / 2; if (gcLen > arrayOfStrings.length) { for (var i = 0; i < gcLen; i++) { - var key = cache.garbageCollect.shift(); - delete cache.data[key]; + delete cache.data[cache.garbageCollect[i]]; } + cache.garbageCollect.splice(0, gcLen); } return longest;