From d570a072a5b2b2cca3fe74bac9b60aebbb6c5b0e Mon Sep 17 00:00:00 2001 From: Anthony Robledo Date: Mon, 27 Jun 2011 14:49:09 -0400 Subject: [PATCH] Breaking out of evaluateAnnotations early if there are no annotations. This resulted in about an 8% speedup. --- dygraph-layout.js | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.7.4