Эх сурвалжийг харах

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 :)
Sebastien Flory 11 жил өмнө
parent
commit
94f969c9a3

+ 4 - 4
spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as

@@ -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;
 			}
 		}