[ https://issues.apache.org/jira/browse/FLEX-34765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Piotr Zarzycki updated FLEX-34765: ---------------------------------- Affects Version/s: Apache Flex 4.14.0 > ArrayCollection/ListCollectionView performance improvements > ----------------------------------------------------------- > > Key: FLEX-34765 > URL: https://issues.apache.org/jira/browse/FLEX-34765 > Project: Apache Flex > Issue Type: Improvement > Components: Collections > Affects Versions: Apache Flex 4.14.0 > Reporter: shane doolan > Labels: newbie, performance > Attachments: FLEX-34765.patch > > > ListCollectionView immediatly adds a CollectionEvent listener to its source > list, even though it only needs the events if sort is set, filterFunction is > set, or it has a CollectionEvent listener of its own. > ArrayList suppresses CollectionEvent creation if there is no CollectionEvent > listener, so by only adding the listener when needed we can improve > performance while reducing the number of CollectionEvent/Array allocations. > Performance profiling of the patch: > ||label||type||objectCount||addItemAtStart||addItemAtEnd||addItemAtRandom||removeItemAtStart||removeItemAtEnd||removeItemAtRandom|| > |Original ArrayCollection: original ArrayList|class > ArrayCollection|100000|2538.556ms|2575.138ms|3268.842ms|3095.744ms|2555.533ms|2828.339ms| > |Patched ArrayCollection: original ArrayList|class > ArrayCollectionListenerPatch|100000|2339.321ms|2338.553ms|3080.970ms|2927.168ms|2364.032ms|2706.899ms| > |Patched ArrayCollection: original ArrayList + CollectionEvent listener|class > ArrayCollectionListenerPatch|100000|2561.900ms|2521.983ms|3262.963ms|3149.099ms|2533.680ms|2884.201ms| > Performance profiling of the patch with the patched ArrayList from > [FLEX-34759]: > ||label||type||objectCount||addItemAtStart||addItemAtEnd||addItemAtRandom||removeItemAtStart||removeItemAtEnd||removeItemAtRandom|| > |Original ArrayCollection: patched ArrayList|class > ArrayCollection|100000|240.839ms|273.501ms|3296.476ms|926.919ms|208.949ms|2856.562ms| > |Patched ArrayCollection: patched ArrayList|class > ArrayCollectionListenerPatch|100000|62.039ms|65.500ms|3131.238ms|706.865ms|36.314ms|2676.732ms| > |Patched ArrayCollection: patched ArrayList + CollectionEvent listener|class > ArrayCollectionListenerPatch|100000|298.581ms|243.448ms|3282.985ms|935.452ms|228.865ms|2880.552ms| > In the above examples: when the patched ArrayCollection doesn't have a > CollectionEvent listener, sort, or filter we avoid allocation of 200,000 > unused CollectionEvents (2 for each add/remove - one dispatched by the array > list to the ListCollectionView, one cloned by the ListCollectionView and > dispatched to nobody) -- This message was sent by Atlassian JIRA (v6.3.4#6332)