You have too much time on your hands...

I would expect collections to iterate much faster by using getItemAt or cursors 
instead of array indexers or for..in.  I swear someone published a comparison 
once.

From: [email protected] [mailto:[email protected]] On Behalf 
Of Josh McDonald
Sent: Thursday, December 11, 2008 2:57 PM
To: [email protected]
Subject: Re: [flexcoders] Re: speed of the "for each" looping


I've spent a lot of time poking around inside the collections stack (it's just 
interesting), and I can't find a situation where you'll get a different order 
for for each..in over indexed looping at the moment (Fx 3). That could of 
course change without notice, but for now I think that where speed isn't 
important, you can safely pick the one that produces the prettier or more 
comprehensible code :)

-Josh
On Fri, Dec 12, 2008 at 5:32 AM, Alex Harui 
<[email protected]<mailto:[email protected]>> wrote:

Funny.   I didn't realize we were talking about iterating arrays with for..in 
until just now.  I don't think we do that in Flex code.  If the docs say arrays 
will iterate via for..in in index order then I'd probably trust that, 
especially if you stuff your arrays in index order



From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] On 
Behalf Of Dave Cragg
Sent: Thursday, December 11, 2008 3:08 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [flexcoders] Re: speed of the "for each" looping



Could you clarify this? Does this non-guarantee apply to numerically indexed 
arrays and ArrayCollections too? Or just to associative arrays and object 
properties?



The docs imply that the order is maintained by for...in with numerically 
indexed arrays. It would be a big change if that were not the case.



Cheers

Dave



On 10 Dec 2008, at 23:00, Gordon Smith wrote:





So don't use for..in or for each... in if you care about the enumeration order. 
It could very possibly change in future versions of the Flash Player.

                                                                                
                                                                         &nbs! 
p;

Gordon Smith

Adobe Flex SDK



--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [email protected]<mailto:[email protected]>
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk

Reply via email to