From 43a36c4867228badc4e9adb3838abb4cc8962d42 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 15 Nov 2012 15:34:48 -0500 Subject: [PATCH] Speed up Graph fetch --- js/iD/graph/Graph.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/iD/graph/Graph.js b/js/iD/graph/Graph.js index 666f7eddc..4363d7ce7 100644 --- a/js/iD/graph/Graph.js +++ b/js/iD/graph/Graph.js @@ -75,9 +75,11 @@ iD.Graph.prototype = { fetch: function(id) { var entity = iD.Entity(this.entities[id]); if (!entity.nodes || !entity.nodes.length) return entity; - entity.nodes = entity.nodes.map(function(id) { - return this.fetch(id); - }.bind(this)); + var nodes = []; + for (var i = 0, l = entity.nodes.length; i < l; i++) { + nodes[i] = this.fetch(entity.nodes[i]); + } + entity.nodes = nodes; return entity; } };