Repository: flex-sdk Updated Branches: refs/heads/XMLListCollectionOptimizations 4c5defffe -> 019a10a10
Updated XMLListAdapter to optimize remove functions. Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/019a10a1 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/019a10a1 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/019a10a1 Branch: refs/heads/XMLListCollectionOptimizations Commit: 019a10a10a6b7a0369fd62088b500f6587e10216 Parents: 4c5deff Author: Nick Kwiatkowski <n...@msu.edu> Authored: Wed May 21 17:13:37 2014 -0400 Committer: Nick Kwiatkowski <n...@msu.edu> Committed: Wed May 21 17:13:37 2014 -0400 ---------------------------------------------------------------------- .../src/mx/collections/XMLListAdapter.as | 31 ++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/019a10a1/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as index b349f92..80cdc27 100644 --- a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as +++ b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as @@ -441,8 +441,9 @@ public class XMLListAdapter extends EventDispatcher implements IList, IXMLNotifi for (var i:int=length - 1; i >= 0; i--) { stopTrackUpdates(source[i]); - delete source[i]; } + + source = new XMLList(); if (_dispatchEvents == 0) { @@ -497,8 +498,34 @@ public class XMLListAdapter extends EventDispatcher implements IList, IXMLNotifi setBusy(); var removed:Object = source[index]; - delete source[index]; stopTrackUpdates(removed); + + // loop through array to remove that index. + + if (length > 1) + { + var newSource:XMLList = new XMLList(); + + for (var i:uint = 0; i < length; i++) + { + if (i < index) + { + newSource[i] = source[i]; + } + else if (i > index) + { + newSource[i-1] = source[i]; + } + } + + source = newSource; + } + else + { + source = new XMLList(); + } + + if (_dispatchEvents == 0) { var event:CollectionEvent =