[ 
https://issues.apache.org/jira/browse/FLEX-12736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Justin Mclean updated FLEX-12736:
---------------------------------

    Labels: performance  (was: )
    
> ListViewCollection.sort exponentially slower than Array.sort
> ------------------------------------------------------------
>
>                 Key: FLEX-12736
>                 URL: https://issues.apache.org/jira/browse/FLEX-12736
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Collections
>    Affects Versions: Adobe Flex SDK Previous
>         Environment: Affected OS(s): Windows
> Affected OS(s): Windows XP
> Language Found: English
>            Reporter: Adobe JIRA
>              Labels: performance
>
> By chance I was looking at the SDK code for ListViewCollection.sort and was 
> surprised at the algorithm used.  Tested showed that it's exponentially 
> slower than Array.sort().  Granted, it only matters on collections with more 
> than 1,000 items which is bad in a real app anyways, but still, it's a huge 
> difference in large collections.
> Steps to reproduce:
> 1.  Create a large collection as both an Array and as ArrayCollection
> 2.  sort the array and set the sort property of the ArrayCollection
> 3.  loop through each a few times
>  
>  Actual Results:
>  
> looping through a sorted array collection is incredibly slower than sorting 
> an array one time, especially when you loop many times as the collection 
> doesn't cache a sorted index
>  
>  Expected Results:
>  
> I figured collection would store a sorted index and there would be a nominal 
> difference in performance
>  
>  Workaround (if any):
>  
> don't use ArrayCollection.sort property if you have a ridiculous number of 
> items (which you really shouldn't have in the first place)
> Note that on several occasions I got a script error saying a script was 
> causing the app to run slowly when sorting a 1,000,000 item collection (yeah, 
> too big collection, but still, Array.sort() handles it fine).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to