Potentialy faster array allocation in rbush

This commit is contained in:
Guillaume Beraudo
2014-12-05 14:29:41 +01:00
parent 9802cfd56f
commit e4063102b7

View File

@@ -74,7 +74,7 @@ ol.structs.RBush.prototype.load = function(extents, values) {
}
goog.asserts.assert(extents.length === values.length);
var items = [];
var items = new Array(values.length);
for (var i = 0, l = values.length; i < l; i++) {
var extent = extents[i];
var value = values[i];
@@ -86,7 +86,7 @@ ol.structs.RBush.prototype.load = function(extents, values) {
extent[3],
value
];
items.push(item);
items[i] = item;
goog.object.add(this.items_, goog.getUid(value).toString(), item);
}
this.rbush_.load(items);