Caching array length instead of accessing it with each iteration. r=crschmidt (closes #1636)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7627 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -45,7 +45,7 @@ OpenLayers.Geometry.Curve = OpenLayers.Class(OpenLayers.Geometry.MultiPoint, {
|
||||
getLength: function() {
|
||||
var length = 0.0;
|
||||
if ( this.components && (this.components.length > 1)) {
|
||||
for(var i=1; i < this.components.length; i++) {
|
||||
for(var i=1, len=this.components.length; i<len; i++) {
|
||||
length += this.components[i-1].distanceTo(this.components[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user