Avoid silent Array allocations

Hello,

In AS3, if a function accepts an arbitrary number of arguments, it will create an Array object behind the scene.
Math.min / Math.max are famous culprits :)
This commit is contained in:
Sebastien Flory 2014-09-29 18:10:41 +02:00
parent 9a1447b799
commit 94f969c9a3

View File

@ -243,10 +243,10 @@ public class SkeletonSprite extends DisplayObject {
continue;
for (var ii:int = 0; ii < verticesLength; ii += 2) {
var x:Number = worldVertices[ii], y:Number = worldVertices[ii + 1];
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x);
maxY = Math.max(maxY, y);
minX = minX < x ? minX : x;
minY = minY < y ? minY : y;
maxX = maxX > x ? maxX : x;
maxY = maxY > y ? maxY : y;
}
}