[Flashcoders] Performance from casting array/vector?

2009-12-26 Thread Steven Sacks
var instance1:MyClass = new MyClass(); var instance2:MyClass = new MyClass(); var instance3:MyClass = new MyClass(); var myArray:Array = [instance1, instance2, instance3]; // QUESTION A: CASTING WITH ARRAYS var i:int = myArray.length; while (i--) { // [A1] - Does Flash have to do a look up

Re: [Flashcoders] Performance from casting array/vector?

2009-12-26 Thread Piers Cowburn
*Disclaimer* This is un-benchmarked, but it's what I usually work to! If anyone has any corrections re. speed, I'd be glad to hear them :) AFAIK, using implicit casting rather than explicit in this case is faster, so A1 in your examples is faster than A2. Also, it's better to move your variable

Re: [Flashcoders] Performance from casting array/vector?

2009-12-26 Thread Fumio Nonaka
A variable declaration is processed before statements. Therefore, it does not matter if it is inside or outside a loop. myClass = new MyClass(); trace(myClass); // Output: [object MyClass] while (false) { var myClass:MyClass; } _ Piers Cowburn wrote: AFAIK, using implicit casting