Someone already mentioned what it is - the for in loop vs the straight for loop.
for (var i in array) ends up pushing all the keys of the array on the stack, and then popping those off. for (var i =0; i< array.length; i++) doesn't. The test attaches 500 listeners to each dispatcher, so when you use the for (var i in array), you're pushing quite a few items on the stack, and it's possible that the mac flash player has slower stack access, or that that particular opcode is significantly slower. Note - the eventdispatcher code uses the for (var i in array) explicitly so that if a listener is removed from the array while dispatching an event that it still dispatches to all listeners. Be careful if you try to just change the loop. Also, why would you have 500 listeners to one broadcaster? The vast majority of the UI code that I've dealt with has 0-2 listeners. The difference between the two might be a lot smaller in that case. --Brian On 3/22/07, Cedric Muller <[EMAIL PROTECTED]> wrote:
interestingly, NO single FLASHCODER can say what it is about... meaning, we all lack of understanding of our environnement :P have a nice day all of you who doesn't understand what is going on with the EventDispatcher class ... a true study case this one ... a true! Cedric _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

