Quick Array Performance Question

How much of a performance drain would this be? Here is a trace of my array:

trace(myArray); //My array
Result: “,[object Object],[object Object]”

As you can see… There are only two objects in the array, at an index of around 40. Now imagine an array with two objects at an index of 600,000,000+ and running this code:


for (var i:int in myArray) {
   trace(myArray*.objectVar);
}

Would this be too slow?

I need to know if I need to change my array to not use ID’s, and instead use push and a search function.

I added two functions to my code to make it more efficient.

I simply push player data objects onto an array, and search the objects in the array find the player data.

Much more efficient?


        function getPlayerData(Id):Object {
            var result:Object;
            for (var i:String in Players) {
                if (Players*.Id == Id) {
                    result = Players*;
                }
            }
            return result;
        }
        function getPlayerDataIndex(Id):int {
            var result:int;
            for (var i:String in Players) {
                if (Players*.Id == Id) {
                    result = int(i);
                }
            }
            return result;
        }