From: Anthony Robledo Date: Mon, 27 Jun 2011 18:49:09 +0000 (-0400) Subject: Breaking out of evaluateAnnotations early if there are no annotations. X-Git-Tag: v1.0.0~459^2~1 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=d570a072a5b2b2cca3fe74bac9b60aebbb6c5b0e;p=dygraphs.git Breaking out of evaluateAnnotations early if there are no annotations. This resulted in about an 8% speedup. --- diff --git a/dygraph-layout.js b/dygraph-layout.js index 9c70965..99ae50c 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -222,6 +222,13 @@ DygraphLayout.prototype._evaluateAnnotations = function() { } this.annotated_points = []; + + // Exit the function early if there are no annotations. + if (!this.annotations || !this.annotations.length) { + return; + } + + // TODO(antrob): loop through annotations not points. for (var i = 0; i < this.points.length; i++) { var p = this.points[i]; var k = p.xval + "," + p.name;