Cache fetch results, higher features limit

This commit is contained in:
Tom MacWright
2013-01-16 13:54:53 -05:00
parent 199584fbff
commit 0e9e14102e
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -13,6 +13,7 @@ iD.Graph = function(entities) {
this.transients = {};
this._parentWays = {};
this._parentRels = {};
this._fetches = {};
if (iD.debug) {
Object.freeze(this);
@@ -119,12 +120,13 @@ iD.Graph.prototype = {
// Resolve the id references in a way, replacing them with actual objects.
fetch: function(id) {
if (this._fetches[id]) return this._fetches[id];
var entity = this.entities[id], nodes = [];
if (!entity || !entity.nodes || !entity.nodes.length) return entity;
for (var i = 0, l = entity.nodes.length; i < l; i++) {
nodes[i] = this.fetch(entity.nodes[i]);
}
return iD.Entity(entity, {nodes: nodes});
return (this._fetches[id] = iD.Entity(entity, {nodes: nodes}));
},
difference: function (graph) {
+1 -1
View File
@@ -80,7 +80,7 @@ iD.Map = function() {
filter = function(d) { return d.midpoint ? d.way in only : d.id in only; };
}
if (all.length > 10000) {
if (all.length > 100000) {
editOff();
return;
}