incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fri...@apache.org
Subject svn commit: r1234229 [1/4] - in /incubator/flex/whiteboard/frishy: ./ FastGroupingCollection/ FastGroupingCollection/.settings/ FastGroupingCollection/libs/ FastGroupingCollection/src/ FastGroupingCollection/src/com/ FastGroupingCollection/src/com/fris...
Date Sat, 21 Jan 2012 01:33:28 GMT
Author: frishy
Date: Sat Jan 21 01:33:26 2012
New Revision: 1234229

URL: http://svn.apache.org/viewvc?rev=1234229&view=rev
Log:
Adding in FastGroupingCollection code.  This class fixes some bugs that are in GroupingCollection2 and is optimized with performance in mind.  Still a few TODOs, though.

Added:
    incubator/flex/whiteboard/frishy/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/.actionScriptProperties
    incubator/flex/whiteboard/frishy/FastGroupingCollection/.flexProperties
    incubator/flex/whiteboard/frishy/FastGroupingCollection/.project   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/.settings/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/.settings/org.eclipse.core.resources.prefs
    incubator/flex/whiteboard/frishy/FastGroupingCollection/libs/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/AdvancedDataGridTest.mxml   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTest.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTestsLoopObjects.mxml   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/ConfigurableCollectionTests.mxml   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/FastAdvancedDataGridTest.mxml   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/TestFGC.mxml   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/TestGC2.mxml   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/CollectionUtil.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/FastGroupingCollection.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/ISummaryCalculator2.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/PriorityQueue.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/summarycalculators/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/summarycalculators/ReturnArrayOfChildValuesSummaryCalculator.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/summarycalculators/ReturnChildValueSummaryCalculator.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/collections/supportClasses/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/utils/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/com/frishy/utils/LayoutManagerClientHelper.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/fastdatagridhelpers/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/fastdatagridhelpers/ChangeWatcherAdvancedDataGridItemRenderer.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/fastdatagridhelpers/FastAdvancedDataGrid.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/model/
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/model/NestedPropertyObject.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/model/NonBindableObject.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/model/PropertyChangeBindableObject.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/model/SingleVersionEventBindableObject.as   (with props)
    incubator/flex/whiteboard/frishy/FastGroupingCollection/src/model/UniqueEventBindableObject.as   (with props)

Propchange: incubator/flex/whiteboard/frishy/FastGroupingCollection/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jan 21 01:33:26 2012
@@ -0,0 +1,2 @@
+bin-debug
+bin-release

Added: incubator/flex/whiteboard/frishy/FastGroupingCollection/.actionScriptProperties
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/frishy/FastGroupingCollection/.actionScriptProperties?rev=1234229&view=auto
==============================================================================
--- incubator/flex/whiteboard/frishy/FastGroupingCollection/.actionScriptProperties (added)
+++ incubator/flex/whiteboard/frishy/FastGroupingCollection/.actionScriptProperties Sat Jan 21 01:33:26 2012
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<actionScriptProperties analytics="false" mainApplicationPath="FastAdvancedDataGridTest.mxml" projectUUID="e13dba78-d64f-4af0-8259-85239696df9a" version="10">
+  <compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
+    <compilerSourcePath/>
+    <libraryPath defaultLinkType="0">
+      <libraryPathEntry kind="4" path="">
+        <excludedEntries>
+          <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flex.swc" useDefaultLinkType="false"/>
+          <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/core.swc" useDefaultLinkType="false"/>
+        </excludedEntries>
+      </libraryPathEntry>
+      <libraryPathEntry kind="1" linkType="1" path="libs"/>
+    </libraryPath>
+    <sourceAttachmentPath/>
+  </compiler>
+  <applications>
+    <application path="FastAdvancedDataGridTest.mxml"/>
+  </applications>
+  <modules/>
+  <buildCSSFiles/>
+  <flashCatalyst validateFlashCatalystCompatibility="false"/>
+</actionScriptProperties>

Added: incubator/flex/whiteboard/frishy/FastGroupingCollection/.flexProperties
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/frishy/FastGroupingCollection/.flexProperties?rev=1234229&view=auto
==============================================================================
--- incubator/flex/whiteboard/frishy/FastGroupingCollection/.flexProperties (added)
+++ incubator/flex/whiteboard/frishy/FastGroupingCollection/.flexProperties Sat Jan 21 01:33:26 2012
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="2"/>

Added: incubator/flex/whiteboard/frishy/FastGroupingCollection/.project
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/frishy/FastGroupingCollection/.project?rev=1234229&view=auto
==============================================================================
--- incubator/flex/whiteboard/frishy/FastGroupingCollection/.project (added)
+++ incubator/flex/whiteboard/frishy/FastGroupingCollection/.project Sat Jan 21 01:33:26 2012
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>FastGroupingCollection</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.adobe.flexbuilder.project.flexbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.adobe.flexbuilder.project.flexnature</nature>
+		<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
+	</natures>
+</projectDescription>

Propchange: incubator/flex/whiteboard/frishy/FastGroupingCollection/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/frishy/FastGroupingCollection/.settings/org.eclipse.core.resources.prefs
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/frishy/FastGroupingCollection/.settings/org.eclipse.core.resources.prefs?rev=1234229&view=auto
==============================================================================
--- incubator/flex/whiteboard/frishy/FastGroupingCollection/.settings/org.eclipse.core.resources.prefs (added)
+++ incubator/flex/whiteboard/frishy/FastGroupingCollection/.settings/org.eclipse.core.resources.prefs Sat Jan 21 01:33:26 2012
@@ -0,0 +1,3 @@
+#Sat Jan 21 00:06:59 GMT 2012
+eclipse.preferences.version=1
+encoding/<project>=utf-8

Added: incubator/flex/whiteboard/frishy/FastGroupingCollection/src/AdvancedDataGridTest.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/frishy/FastGroupingCollection/src/AdvancedDataGridTest.mxml?rev=1234229&view=auto
==============================================================================
--- incubator/flex/whiteboard/frishy/FastGroupingCollection/src/AdvancedDataGridTest.mxml (added)
+++ incubator/flex/whiteboard/frishy/FastGroupingCollection/src/AdvancedDataGridTest.mxml Sat Jan 21 01:33:26 2012
@@ -0,0 +1,482 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
+               xmlns:s="library://ns.adobe.com/flex/spark" 
+               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
+    <fx:Script>
+        <![CDATA[
+            import flash.utils.getTimer;
+            
+            import mx.collections.ArrayCollection;
+            import mx.collections.ArrayList;
+            import mx.collections.Grouping;
+            import mx.collections.GroupingCollection;
+            import mx.collections.GroupingCollection2;
+            import mx.collections.GroupingField;
+            import mx.collections.HierarchicalCollectionView;
+            import mx.collections.ICollectionView;
+            import mx.collections.IList;
+            import mx.collections.Sort;
+            import mx.collections.SortField;
+            import mx.events.FlexEvent;
+            import mx.managers.LayoutManager;
+            
+            protected function application1_applicationCompleteHandler(event:FlexEvent):void
+            {
+                
+            }
+            
+            public var collectionTests:CollectionTest = new CollectionTest();
+            public var testResultsAdd:Array;
+            public var testResultsUpdate:Array;
+            
+            public static const NUM_ITERATIONS_PER_SECOND:int = 4;
+            
+            private static const NON_BINDABLE_OBJECT:int = 0;
+            private static const PROPERTY_CHANGE_BINDABLE_OBJECT:int = 1;
+            private static const SINGLE_VERSION_EVENT_BINDABLE_OBJECT:int = 2;
+            private static const UNIQUE_EVENT_BINDABLE_OBJECT:int = 3;
+            
+            private static const ARRAY_COLLECTION_TYPE:int = 0;
+            private static const ARRAY_COLLECTION_FILTER_TYPE:int = 1;
+            private static const ARRAY_COLLECTION_SORT_TYPE:int = 2;
+            private static const ARRAY_COLLECTION_FILTER_SORT_TYPE:int = 3;
+            
+            private static const WRAPPING_COLLECTION_NONE:int = 0;
+            private static const WRAPPING_COLLECTION_HCV_NO_GROUPING:int = 1;
+            private static const WRAPPING_COLLECTION_HCV_WITH_GROUPING:int = 2;
+            
+            public function get numItemsToInitializeWith():int
+            {
+                return seedItemAmountInput.value;
+            }
+            
+            public function get fillSeedItems():Boolean
+            {
+                return fillSeedItemsInput.selected;
+            }
+            
+            public function get numIterations():int
+            {
+                return numSecondsInput.value * NUM_ITERATIONS_PER_SECOND;
+            }
+            
+            public function get numItemsToAddPerSecond():int
+            {
+                return numItemsToAddPerSecondInput.value;
+            }
+            
+            public function get fillObjectsInitially():Boolean
+            {
+                return fillObjectsInitiallyCheckBox.selected;
+            }
+            
+            public function get numItemsToUpdatePerSecond():int
+            {
+                return numItemsToUpdatePerSecondInput.value;
+            }
+            
+            public function get numPropertiesPerUpdate():int
+            {
+                return numPropsToUpdatePerObjectUpdateInput.value;
+            }
+            
+            public function runTest():void
+            {
+                
+                collectionTests.addEventListener(CollectionTest.TEST_COMPLETE, testCompleteHandler);
+                
+                switch (collectionToUseDropDownList.selectedIndex)
+                {
+                    case ARRAY_COLLECTION_TYPE:
+                    case ARRAY_COLLECTION_FILTER_TYPE:
+                    case ARRAY_COLLECTION_SORT_TYPE:
+                    case ARRAY_COLLECTION_FILTER_SORT_TYPE:
+                        startCollectionTest();
+                        break;
+                }
+            }
+            
+            private var validationTime:int;
+            private var layoutManagerStartTime:int;
+            private var renderTime:int;
+            private var layoutManagerEndTime:int;
+            
+            private function layoutManager_layoutManagerStartHandler(event:Event):void
+            {
+                layoutManagerStartTime = getTimer();
+            }
+            
+            private function layoutManager_layoutManagerEndHandler(event:Event):void
+            {
+                layoutManagerEndTime = getTimer();
+                validationTime += (layoutManagerEndTime - layoutManagerStartTime);
+            }
+            
+            private function enterFrameHandler(event:Event):void
+            {
+                if (layoutManagerEndTime > 0)
+                {
+                    renderTime += (getTimer() - layoutManagerEndTime);
+                    layoutManagerEndTime = 0;
+                }
+            }
+            
+            private function startCollectionTest():void
+            {
+                var myList:IList = createCollectionObject();
+                
+                var collectionWrapper:Object = wrapInOtherCollectionIfNeeded(myList);
+                
+                applySortAndFilterIfNeeded(collectionWrapper, myList);
+                
+                adg.dataProvider = collectionWrapper;
+                
+                LayoutManager.getInstance().validateNow();
+                
+                LayoutManager.getInstance().addEventListener("layoutManagerStart", layoutManager_layoutManagerStartHandler);
+                LayoutManager.getInstance().addEventListener("updateComplete", layoutManager_layoutManagerEndHandler);
+                addEventListener(Event.ENTER_FRAME, enterFrameHandler);
+                
+                if (numItemsToInitializeWith > 0)
+                {
+                    switch (objectToUseDropDownList.selectedIndex)
+                    {
+                        case NON_BINDABLE_OBJECT:
+                            collectionTests.fillCollectionNonBindable(myList, numItemsToInitializeWith, fillSeedItems);
+                            break;
+                        case PROPERTY_CHANGE_BINDABLE_OBJECT:
+                            collectionTests.fillCollectionPropertyChangeBindable(myList, numItemsToInitializeWith, fillSeedItems);
+                            break;
+                        case UNIQUE_EVENT_BINDABLE_OBJECT:
+                            collectionTests.fillCollectionUniqueEventBindable(myList, numItemsToInitializeWith, fillSeedItems);
+                            break;
+                        case SINGLE_VERSION_EVENT_BINDABLE_OBJECT:
+                            collectionTests.fillCollectionSingleVersionEventBindable(myList, numItemsToInitializeWith, fillSeedItems);
+                            break;
+                    }
+                }
+                
+                if (numItemsToAddPerSecond > 0)
+                {
+                    switch (objectToUseDropDownList.selectedIndex)
+                    {
+                        case NON_BINDABLE_OBJECT:
+                            testResultsAdd = collectionTests.startRandomAdditionsNonBindableCollection(myList, numIterations, numItemsToAddPerSecond, fillObjectsInitially);
+                            break;
+                        case PROPERTY_CHANGE_BINDABLE_OBJECT: 
+                            testResultsAdd = collectionTests.startRandomAdditionsPropertyChangeBindableCollection(myList, numIterations, numItemsToAddPerSecond, fillObjectsInitially);
+                            break;
+                        case UNIQUE_EVENT_BINDABLE_OBJECT:
+                            testResultsAdd = collectionTests.startRandomAdditionsUniqueEventBindableCollection(myList, numIterations, numItemsToAddPerSecond, fillObjectsInitially);
+                            break;
+                        case SINGLE_VERSION_EVENT_BINDABLE_OBJECT:
+                            testResultsAdd = collectionTests.startRandomAdditionsSingleVersionEventBindableCollection(myList, numIterations, numItemsToAddPerSecond, fillObjectsInitially);
+                            break;
+                    }
+                }
+                
+                if (numItemsToUpdatePerSecond > 0)
+                {
+                    testResultsUpdate = collectionTests.startRandomPropertyUpdatesCollection(myList, numIterations, numItemsToUpdatePerSecond, numPropertiesPerUpdate);
+                }
+            }
+            
+            private function createCollectionObject():IList
+            {
+                return new ArrayCollection();
+            }
+            
+            private function applySortAndFilterIfNeeded(
+                collectionWrapper:Object, 
+                underlyingCollection:IList):void
+            {
+                var collectionForFilterAndSort:ICollectionView = collectionWrapper as ICollectionView;
+                if (!collectionForFilterAndSort)
+                    collectionForFilterAndSort = underlyingCollection as ICollectionView;
+                
+                if (collectionToUseDropDownList.selectedIndex == ARRAY_COLLECTION_FILTER_TYPE ||
+                    collectionToUseDropDownList.selectedIndex == ARRAY_COLLECTION_FILTER_SORT_TYPE)
+                {
+                    collectionForFilterAndSort.filterFunction = testFilterFunction;
+                }
+                
+                if (collectionToUseDropDownList.selectedIndex == ARRAY_COLLECTION_SORT_TYPE ||
+                    collectionToUseDropDownList.selectedIndex == ARRAY_COLLECTION_FILTER_SORT_TYPE)
+                {
+                    collectionForFilterAndSort.sort = getTestSort();
+                }
+                
+                if (collectionToUseDropDownList.selectedIndex != ARRAY_COLLECTION_TYPE)
+                {
+                    collectionForFilterAndSort.refresh();
+                }
+            }
+            
+            private function wrapInOtherCollectionIfNeeded(myList:IList):Object
+            {
+                var gc2:GroupingCollection2;
+                var hcv:HierarchicalCollectionView;
+                
+                switch (wrappingCollectionToUseDropDownList.selectedIndex)
+                {
+                    case WRAPPING_COLLECTION_NONE:
+                        return myList;
+                    case WRAPPING_COLLECTION_HCV_NO_GROUPING:
+                        gc2 = new GroupingCollection2();
+                        gc2.source = myList;
+                        gc2.refresh();
+                        hcv = new HierarchicalCollectionView(gc2);
+                        return hcv;
+                    case WRAPPING_COLLECTION_HCV_WITH_GROUPING:
+                        gc2 = new GroupingCollection2();
+                        gc2.grouping = getTestGrouping();
+                        gc2.source = myList;
+                        gc2.refresh();
+                        hcv = new HierarchicalCollectionView(gc2);
+                        return hcv;
+                }
+                
+                return null;
+            }
+            
+            private function getTestGrouping():Grouping
+            {
+                var grouping:Grouping = new Grouping();
+                var gf:GroupingField = new GroupingField("property3");
+                gf.groupingFunction = testGroupingFunction;
+                grouping.fields = [gf];
+                
+                return grouping;
+            }
+            
+            [Bindable]
+            private var numGroupsForGroupingCollection:int = 10;
+            
+            private function testGroupingFunction(item:Object, field:GroupingField):String
+            {
+                var myNumber:Number = item[field.name] as Number;
+                var groupId:Number = Math.floor(myNumber * numGroupsForGroupingCollection);
+                return groupId.toString();
+            }
+            
+            private function testCompleteHandler(event:Event):void
+            {
+                // if haven't finished both tests, wait for next event
+                if (numItemsToAddPerSecond > 0 
+                    && numItemsToUpdatePerSecond > 0 
+                    && testResultsAdd.length != testResultsUpdate.length)
+                {
+                    return;
+                }
+                
+                var collectionTime:int = 0;
+                var len:int = testResultsAdd ? testResultsAdd.length : 0;
+                for (var i:int = 0; i < len; i++)
+                {
+                    collectionTime += testResultsAdd[i];
+                }
+                
+                len = testResultsUpdate ? testResultsUpdate.length : 0;
+                for (i = 0; i < len; i++)
+                {
+                    collectionTime += testResultsUpdate[i];
+                }
+                
+                testResultsAdd = testResultsUpdate = null;
+                
+                var totalTime:Number = collectionTime + validationTime + renderTime;
+                resultLabel.text += ": (" + collectionTime + ", " + validationTime + ", " + renderTime + ", " + totalTime + ") ";
+                
+                collectionTests.removeEventListener(CollectionTest.TEST_COMPLETE, testCompleteHandler);
+                LayoutManager.getInstance().removeEventListener("layoutManagerStart", layoutManager_layoutManagerStartHandler);
+                LayoutManager.getInstance().removeEventListener("updateComplete", layoutManager_layoutManagerEndHandler);
+                removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
+                
+            }
+            
+            [Bindable]
+            public var valToTestForGreaterThanInFilterFunction:Number = 0.8;
+            
+            public function testFilterFunction(item:Object):Boolean
+            {
+                if ("property0" in item)
+                    return item.property0 > valToTestForGreaterThanInFilterFunction;
+                else
+                    return true; // for groups
+            }
+            
+            public function getTestSort():Sort
+            {
+                var sort:Sort = new Sort();
+                sort.fields = [new SortField("property1")];
+                return sort;
+            }
+            
+            private function formatIntTo3Digits(value:int):String
+            {
+                if (value >= 100)
+                    return "" + value;
+                else if (value >= 10)
+                    return "0" + value;
+                else
+                    return "00" + value;
+            }
+            
+            private function formatIntTo5Digits(value:int):String
+            {
+                if (value >= 10000)
+                    return "" + value;
+                if (value >= 1000)
+                    return "0" + value;
+                if (value >= 100)
+                    return "00" + value;
+                else if (value >= 10)
+                    return "000" + value;
+                else
+                    return "0000" + value;
+            }
+            
+        ]]>
+    </fx:Script>
+    <fx:Declarations>
+        <!-- Place non-visual elements (e.g., services, value objects) here -->
+        <s:NumberFormatter id="decimalFormatterPrecision2" trailingZeros="true" leadingZero="true" fractionalDigits="2" />
+    </fx:Declarations>
+    <s:layout>
+        <s:VerticalLayout />
+    </s:layout>
+    
+    <s:FormItem label="Object to use">
+        <s:DropDownList id="objectToUseDropDownList" requireSelection="true" width="200">
+            <s:ArrayList>
+                <fx:String>NonBindableObject</fx:String>
+                <fx:String>PropertyChangeBindableObject</fx:String>
+                <fx:String>SingleVersionEventBindableObject</fx:String>
+                <fx:String>UniqueEventBindableObject</fx:String>
+            </s:ArrayList>
+        </s:DropDownList>
+    </s:FormItem>
+    
+    <s:HGroup>
+        <s:FormItem label="Collection to use">
+            <s:DropDownList id="collectionToUseDropDownList" requireSelection="true" width="200">
+                <s:ArrayList>
+                    <fx:String>ArrayCollection</fx:String>
+                    <fx:String>ArrayCollection + Filter</fx:String>
+                    <fx:String>ArrayCollection + Sort</fx:String>
+                    <fx:String>ArrayCollection + Filter + Sort</fx:String>
+                </s:ArrayList>
+            </s:DropDownList>
+        </s:FormItem>
+        <s:FormItem label="Wrapping Collection to use">
+            <s:DropDownList id="wrappingCollectionToUseDropDownList" requireSelection="true" width="200">
+                <s:ArrayList>
+                    <fx:String>None</fx:String>
+                    <fx:String>HCV wrapping GC2 no grouping</fx:String>
+                    <fx:String>HCV wrapping GC2 group by 1 field</fx:String>
+                </s:ArrayList>
+            </s:DropDownList>
+        </s:FormItem>
+    </s:HGroup>
+    
+    <s:HGroup>
+        <s:FormItem label="Seed with items ({formatIntTo5Digits(seedItemAmountInput.value)})" >
+            <s:NumericStepper id="seedItemAmountInput" minimum="10" maximum="1000000" value="100" stepSize="5"  />
+        </s:FormItem>
+        <s:FormItem label="Fill seed items">
+            <s:CheckBox id="fillSeedItemsInput" selected="false" />
+        </s:FormItem>
+    </s:HGroup>
+    
+    <s:FormItem label="Num Seconds ({formatIntTo3Digits(numSecondsInput.value)})" >
+        <s:NumericStepper id="numSecondsInput" minimum="5" maximum="300" value="20" snapInterval="1" stepSize="5" />
+    </s:FormItem>
+    
+    <s:HGroup>
+        <s:FormItem label="Num items to add per second ({formatIntTo3Digits(numItemsToAddPerSecondInput.value)})">
+            <s:NumericStepper id="numItemsToAddPerSecondInput" minimum="0" maximum="300" value="50" snapInterval="1" stepSize="5" />
+        </s:FormItem>
+        <s:FormItem label="Fill added objects initially">
+            <s:CheckBox id="fillObjectsInitiallyCheckBox" selected="false" />
+        </s:FormItem>
+    </s:HGroup>
+    
+    <s:HGroup>
+        <s:FormItem label="Num items to update per second ({formatIntTo3Digits(numItemsToUpdatePerSecondInput.value)})">
+            <s:NumericStepper id="numItemsToUpdatePerSecondInput" minimum="0" maximum="300" value="100" snapInterval="1" stepSize="5" />
+        </s:FormItem>
+        <s:FormItem label="Num props per update ({formatIntTo3Digits(numPropsToUpdatePerObjectUpdateInput.value)})">
+            <s:NumericStepper id="numPropsToUpdatePerObjectUpdateInput" minimum="0" maximum="30" value="10" snapInterval="1" stepSize="5" />
+        </s:FormItem> 
+    </s:HGroup>
+    
+    <s:HGroup>
+        <s:FormItem label="Value to test for greater than in filter function ({decimalFormatterPrecision2.format(valToTestForGreaterThanInFilterFunction)})">
+            <s:NumericStepper minimum="0" maximum="1" value="@{valToTestForGreaterThanInFilterFunction}" snapInterval="0.05" stepSize="0.05" />
+        </s:FormItem>
+        <s:FormItem label="Num groups to have if wrapping with a grouping collection ({formatIntTo3Digits(numGroupsForGroupingCollection)})">
+            <s:NumericStepper value="@{numGroupsForGroupingCollection}" minimum="1" maximum="200" snapInterval="1" stepSize="1" />
+        </s:FormItem>
+    </s:HGroup>
+    
+    <s:HGroup>
+        <s:Button label="Run test" click="runTest()" />
+        <s:Label id="resultLabel" text="Result: " />
+    </s:HGroup>
+    
+    <mx:AdvancedDataGrid id="adg" height="600" width="1200" 
+                         horizontalScrollPolicy="on" displayItemsExpanded="true">
+        <mx:groupItemRenderer>
+            <fx:Component>
+                <mx:AdvancedDataGridGroupItemRenderer dataChange="advanceddatagridgroupitemrenderer1_dataChangeHandler(event)">
+                    <fx:Script>
+                        <![CDATA[
+                            import mx.events.FlexEvent;
+                            import mx.controls.AdvancedDataGrid;
+                            
+                            protected function advanceddatagridgroupitemrenderer1_dataChangeHandler(event:FlexEvent):void
+                            {
+                                if (listData && data)
+                                {
+//                                    AdvancedDataGrid(listData.owner).expandItem(data, true);
+                                }
+                            }
+                        ]]>
+                    </fx:Script>
+                </mx:AdvancedDataGridGroupItemRenderer>
+                </fx:Component>
+        </mx:groupItemRenderer>
+        <mx:columns>
+            <mx:AdvancedDataGridColumn dataField="property3" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property0" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property1" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property2" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property4" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property5" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property6" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property7" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property8" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property9" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property10" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property11" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property13" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property12" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property14" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property15" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property16" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property17" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property18" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property19" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property20" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property21" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property22" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property23" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property24" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property25" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property26" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property27" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property28" width="80" />
+            <mx:AdvancedDataGridColumn dataField="property29" width="80" />
+        </mx:columns>
+    </mx:AdvancedDataGrid>
+</s:Application>

Propchange: incubator/flex/whiteboard/frishy/FastGroupingCollection/src/AdvancedDataGridTest.mxml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTest.as?rev=1234229&view=auto
==============================================================================
--- incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTest.as (added)
+++ incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTest.as Sat Jan 21 01:33:26 2012
@@ -0,0 +1,644 @@
+package
+{
+    import flash.events.Event;
+    import flash.events.EventDispatcher;
+    import flash.events.TimerEvent;
+    import flash.utils.Timer;
+    import flash.utils.getTimer;
+    
+    import mx.collections.ArrayCollection;
+    import mx.collections.ICollectionView;
+    import mx.collections.IList;
+    import mx.collections.IViewCursor;
+    import model.NonBindableObject;
+    import model.PropertyChangeBindableObject;
+    import model.SingleVersionEventBindableObject;
+    import model.UniqueEventBindableObject;
+
+    public class CollectionTest extends EventDispatcher
+    {
+        public function CollectionTest()
+        {
+        }
+        
+        public function fillCollectionNonBindable(list:IList, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:NonBindableObject = new NonBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.addItem(newObject);
+            }
+        }
+        
+        public function fillCollectionPropertyChangeBindable(list:IList, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:PropertyChangeBindableObject = new PropertyChangeBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.addItem(newObject);
+            }
+        }
+        
+        public function fillCollectionUniqueEventBindable(list:IList, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:UniqueEventBindableObject = new UniqueEventBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.addItem(newObject);
+            }
+        }
+        
+        public function fillCollectionSingleVersionEventBindable(list:IList, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:SingleVersionEventBindableObject = new SingleVersionEventBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.addItem(newObject);
+            }
+        }
+        
+        public function fillArrayNonBindable(list:Array, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:NonBindableObject = new NonBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.push(newObject);
+            }
+        }
+        
+        public function fillArrayPropertyChangeBindable(list:Array, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:PropertyChangeBindableObject = new PropertyChangeBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.push(newObject);
+            }
+        }
+        
+        public function fillArrayUniqueEventBindable(list:Array, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:UniqueEventBindableObject = new UniqueEventBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.push(newObject);
+            }
+        }
+        
+        public function fillArraySingleVersionEventBindable(list:Array, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:SingleVersionEventBindableObject = new SingleVersionEventBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.push(newObject);
+            }
+        }
+        
+        public function fillVectorNonBindable(list:Vector.<Object>, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:NonBindableObject = new NonBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.push(newObject);
+            }
+        }
+        
+        public function fillVectorPropertyChangeBindable(list:Vector.<Object>, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:PropertyChangeBindableObject = new PropertyChangeBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.push(newObject);
+            }
+        }
+        
+        public function fillVectorUniqueEventBindable(list:Vector.<Object>, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:UniqueEventBindableObject = new UniqueEventBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.push(newObject);
+            }
+        }
+        
+        public function fillVectorSingleVersionEventBindable(list:Vector.<Object>, numItems:int, fillObjects:Boolean):void
+        {
+            for (var i:int = 0; i < numItems; i++)
+            {
+                var newObject:SingleVersionEventBindableObject = new SingleVersionEventBindableObject();
+                if (fillObjects)
+                    newObject.fillAllProperties();
+                list.push(newObject);
+            }
+        }
+        
+        
+        public static const TIMER_INTERVAL:int = 250;
+        
+        public function startRandomPropertyUpdatesCollection(list:IList, numIterations:int, numItemsPerSecond:int, numPropertiesPerUpdate:int):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var listToUse:IList = (list is ArrayCollection && ArrayCollection(list).filterFunction != null) ? ArrayCollection(list).list : list;
+                
+                if (listToUse.length == 0)
+                    return;
+                
+                var startTime:int = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var randomObjectIndex:int = Math.floor(Math.random() * listToUse.length);
+                    var objectToModify:Object = listToUse.getItemAt(randomObjectIndex);
+                    
+                    objectToModify.fillNRandomProperties(numPropertiesPerUpdate);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomPropertyUpdatesArray(list:Array, numIterations:int, numItemsPerSecond:int, numPropertiesPerUpdate:int):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                if (list.length == 0)
+                    return;
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var randomObjectIndex:int = Math.floor(Math.random() * list.length);
+                    var objectToModify:Object = list[randomObjectIndex];
+                    
+                    objectToModify.fillNRandomProperties(numPropertiesPerUpdate);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomPropertyUpdatesVector(list:Vector.<Object>, numIterations:int, numItemsPerSecond:int, numPropertiesPerUpdate:int):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                if (list.length == 0)
+                    return;
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var randomObjectIndex:int = Math.floor(Math.random() * list.length);
+                    var objectToModify:Object = list[randomObjectIndex];
+                    
+                    objectToModify.fillNRandomProperties(numPropertiesPerUpdate);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsNonBindableCollection(list:IList, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:NonBindableObject = new NonBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.addItem(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsPropertyChangeBindableCollection(list:IList, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:PropertyChangeBindableObject = new PropertyChangeBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.addItem(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsUniqueEventBindableCollection(list:IList, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:UniqueEventBindableObject = new UniqueEventBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.addItem(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsSingleVersionEventBindableCollection(list:IList, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:SingleVersionEventBindableObject = new SingleVersionEventBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.addItem(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsNonBindableArray(list:Array, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:NonBindableObject = new NonBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.push(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsPropertyChangeBindableArray(list:Array, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:PropertyChangeBindableObject = new PropertyChangeBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.push(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsUniqueEventBindableArray(list:Array, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:UniqueEventBindableObject = new UniqueEventBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.push(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsSingleVersionEventBindableArray(list:Array, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:SingleVersionEventBindableObject = new SingleVersionEventBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.push(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsNonBindableVector(list:Vector.<Object>, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:NonBindableObject = new NonBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.push(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsPropertyChangeBindableVector(list:Vector.<Object>, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:PropertyChangeBindableObject = new PropertyChangeBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.push(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public static const TEST_COMPLETE:String = "testComplete";
+        
+        private function timerCompleteEventHandler(event:TimerEvent):void
+        {
+            dispatchEvent(new Event(TEST_COMPLETE));
+        }
+        
+        public function startRandomAdditionsUniqueEventBindableVector(list:Vector.<Object>, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:UniqueEventBindableObject = new UniqueEventBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.push(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function startRandomAdditionsSingleVersionEventBindableVector(list:Vector.<Object>, numIterations:int, numItemsPerSecond:int, fillObjects:Boolean):Array
+        {
+            var timer:Timer = new Timer(TIMER_INTERVAL, numIterations);
+            var numTicksPerSecond:Number = 1000/TIMER_INTERVAL;
+            var numItemsPerTick:int = numItemsPerSecond/numTicksPerSecond;
+            var timerResults:Array = [];
+            timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
+            {
+                var startTime:Number = getTimer();
+                for (var i:int = 0; i < numItemsPerTick; i++)
+                {
+                    var newObject:SingleVersionEventBindableObject = new SingleVersionEventBindableObject();
+                    if (fillObjects)
+                        newObject.fillAllProperties();
+                    list.push(newObject);
+                }
+                timerResults.push(getTimer() - startTime);
+            });
+            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
+            
+            timer.start();
+            return timerResults;
+        }
+        
+        public function iterateOverAllElementsCollectionView(list:ICollectionView, numIterations:int):void
+        {
+            for (var iter:int = 0; iter < numIterations; iter++)
+            {
+                var cursor:IViewCursor = list.createCursor();
+                
+                var hasNext:Boolean = !cursor.afterLast;
+                while (hasNext)
+                {
+                    var objectGotten:Object = cursor.current;
+                    hasNext = cursor.moveNext();
+                }
+            }
+        }
+        
+        public function iterateOverAllElementsCollectionGetItemAt(list:IList, numIterations:int):void
+        {
+            for (var iter:int = 0; iter < numIterations; iter++)
+            {
+                var len:int = list.length;
+                for (var i:int = 0; i < len; i++)
+                {
+                    var objectGotten:Object = list.getItemAt(i);
+                }
+            }
+        }
+        
+        public function iterateOverAllElementsCollectionBracketIndex(list:IList, numIterations:int):void
+        {
+            for (var iter:int = 0; iter < numIterations; iter++)
+            {
+                var len:int = list.length;
+                for (var i:int = 0; i < len; i++)
+                {
+                    var objectGotten:Object = list[i];
+                }
+            }
+        }
+        
+        public function iterateOverAllElementsCollectionForEach(list:IList, numIterations:int):void
+        {
+            for (var iter:int = 0; iter < numIterations; iter++)
+            {
+                for each (var object:Object in list)
+                {
+                    // do nothing
+                }
+            }
+        }
+        
+        public function iterateOverAllElementsArrayFor(list:Array, numIterations:int):void
+        {
+            for (var iter:int = 0; iter < numIterations; iter++)
+            {
+                var len:int = list.length;
+                for (var i:int = 0; i < len; i++)
+                {
+                    var objectGotten:Object = list[i];
+                }
+            }
+        }
+        
+        public function iterateOverAllElementsArrayForEach(list:Array, numIterations:int):void
+        {
+            for (var iter:int = 0; iter < numIterations; iter++)
+            {
+                for each (var object:Object in list)
+                {
+                    // do nothing
+                }
+            }
+        }
+        
+        public function iterateOverAllElementsVectorFor(list:Vector.<Object>, numIterations:int):void
+        {
+            for (var iter:int = 0; iter < numIterations; iter++)
+            {
+                var len:int = list.length;
+                for (var i:int = 0; i < len; i++)
+                {
+                    var objectGotten:Object = list[i];
+                }
+            }
+        }
+        
+        public function iterateOverAllElementsVectorForEach(list:Vector.<Object>, numIterations:int):void
+        {
+            for (var iter:int = 0; iter < numIterations; iter++)
+            {
+                for each (var object:Object in list)
+                {
+                    // do nothing
+                }
+            }
+        }
+        
+        // test Array, Vector, ArrayList, ArrayCollection, GroupingCollection, VectorList
+        
+        // test one large write with full objects
+        // test lots of updates
+        // test lots of additions
+        // test lots of updates and additions
+        // test different ways to get items (getItemAt(), [], for each, for var)
+        
+        // test all above with filters, sort, and filters and sort
+        // test with Grouping changes too
+        
+        // test all above with Bindable propertyChange object, individual event binding, no binding
+    }
+}
\ No newline at end of file

Propchange: incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTest.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTestsLoopObjects.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTestsLoopObjects.mxml?rev=1234229&view=auto
==============================================================================
--- incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTestsLoopObjects.mxml (added)
+++ incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTestsLoopObjects.mxml Sat Jan 21 01:33:26 2012
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
+               xmlns:s="library://ns.adobe.com/flex/spark" 
+               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
+               applicationComplete="application1_applicationCompleteHandler(event)">
+    <fx:Script>
+        <![CDATA[
+            import com.frishy.collections.FastGroupingCollection;
+            
+            import flash.utils.getTimer;
+            
+            import mx.collections.ArrayCollection;
+            import mx.collections.ArrayList;
+            import mx.collections.IList;
+            import mx.collections.Sort;
+            import mx.collections.SortField;
+            import mx.events.FlexEvent;
+            
+            protected function application1_applicationCompleteHandler(event:FlexEvent):void
+            {
+                var fgc:FastGroupingCollection = new FastGroupingCollection();
+            }
+            
+            public static const NUM_ITEMS:int = 1000;
+            public static const NUM_ITER:int = 1000;
+            public var collectionTests:CollectionTest = new CollectionTest();
+            
+            public function test1():void
+            {
+                var list:IList = new ArrayCollection();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionBracketIndex(list, NUM_ITER);
+                test1Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test2():void
+            {
+                var list:IList = new ArrayCollection();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionForEach(list, NUM_ITER);
+                test2Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test3():void
+            {
+                var list:IList = new ArrayCollection();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionGetItemAt(list, NUM_ITER);
+                test3Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test4():void
+            {
+                var list:ArrayCollection = new ArrayCollection();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionView(list, NUM_ITER);
+                test4Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function testFilterFunction(item:Object):Boolean
+            {
+                return item.property0 > 0.8;
+            }
+            
+            public function getTestSort():Sort
+            {
+                var sort:Sort = new Sort();
+                sort.fields = [new SortField("property1")];
+                return sort;
+            }
+            
+            public function test5():void
+            {
+                var list:ArrayCollection = new ArrayCollection();
+                list.filterFunction = testFilterFunction;
+                list.sort = getTestSort();
+                list.refresh();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionBracketIndex(list, NUM_ITER);
+                test5Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test6():void
+            {
+                var list:ArrayCollection = new ArrayCollection();
+                list.filterFunction = testFilterFunction;
+                list.sort = getTestSort();
+                list.refresh();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionForEach(list, NUM_ITER);
+                test6Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test7():void
+            {
+                var list:ArrayCollection = new ArrayCollection();
+                list.filterFunction = testFilterFunction;
+                list.sort = getTestSort();
+                list.refresh();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionGetItemAt(list, NUM_ITER);
+                test7Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test8():void
+            {
+                var list:ArrayCollection = new ArrayCollection();
+                list.filterFunction = testFilterFunction;
+                list.sort = getTestSort();
+                list.refresh();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionView(list, NUM_ITER);
+                test8Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test9():void
+            {
+                var list:IList = new ArrayList();
+                collectionTests.fillCollectionNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsCollectionGetItemAt(list, NUM_ITER);
+                test9Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test10():void
+            {
+                var list:Array = new Array();
+                collectionTests.fillArrayNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsArrayFor(list, NUM_ITER);
+                test10Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test11():void
+            {
+                var list:Array = new Array();
+                collectionTests.fillArrayNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsArrayForEach(list, NUM_ITER);
+                test11Label.text += ": " + (getTimer() - startTime);
+            }
+
+            public function test12():void
+            {
+                var list:Vector.<Object> = new Vector.<Object>();
+                collectionTests.fillVectorNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsVectorForEach(list, NUM_ITER);
+                test12Label.text += ": " + (getTimer() - startTime);
+            }
+            
+            public function test13():void
+            {
+                var list:Vector.<Object> = new Vector.<Object>();
+                collectionTests.fillVectorNonBindable(list, NUM_ITEMS, true);
+                var startTime:Number = getTimer();
+                collectionTests.iterateOverAllElementsVectorForEach(list, NUM_ITER);
+                test13Label.text += ": " + (getTimer() - startTime);
+            }
+            
+        ]]>
+    </fx:Script>
+    <fx:Declarations>
+        <!-- Place non-visual elements (e.g., services, value objects) here -->
+    </fx:Declarations>
+    <s:layout>
+        <s:VerticalLayout />
+    </s:layout>
+    <s:HGroup>
+        <s:VGroup>
+            <s:Label id="test1Label" text="Loop ArrayCollection for and bracket" />
+            <s:Button click="test1()" />
+        </s:VGroup>
+        <s:VGroup>
+            <s:Label id="test2Label" text="Loop ArrayCollection for each" />
+            <s:Button click="test2()" />
+        </s:VGroup>
+    </s:HGroup>
+    <s:HGroup>
+        <s:VGroup>
+            <s:Label id="test3Label" text="Loop ArrayCollection for and getItem()" />
+            <s:Button click="test3()" />
+        </s:VGroup>
+        <s:VGroup>
+            <s:Label id="test4Label" text="Loop ArrayCollection IViewCursor" />
+            <s:Button click="test4()" />
+        </s:VGroup>
+    </s:HGroup>
+    <s:HGroup>
+        <s:VGroup>
+            <s:Label id="test5Label" text="Loop ArrayCollection (filter and sort) for and bracket" />
+            <s:Button click="test5()" />
+        </s:VGroup>
+        <s:VGroup>
+            <s:Label id="test6Label" text="Loop ArrayCollection (filter and sort) for each" />
+            <s:Button click="test6()" />
+        </s:VGroup>
+    </s:HGroup>
+    <s:HGroup>
+        <s:VGroup>
+            <s:Label id="test7Label" text="Loop ArrayCollection (filter and sort) for and getItem()" />
+            <s:Button click="test7()" />
+        </s:VGroup>
+        <s:VGroup>
+            <s:Label id="test8Label" text="Loop ArrayCollection (filter and sort) IViewCursor" />
+            <s:Button click="test8()" />
+        </s:VGroup>
+    </s:HGroup>
+    <s:HGroup>
+        <s:VGroup>
+            <s:Label id="test9Label" text="Loop ArrayList for and getItem()" />
+            <s:Button click="test9()" />
+        </s:VGroup>
+    </s:HGroup>
+    <s:HGroup>
+        <s:VGroup>
+            <s:Label id="test10Label" text="Loop Array for and bracket" />
+            <s:Button click="test10()" />
+        </s:VGroup>
+        <s:VGroup>
+            <s:Label id="test11Label" text="Loop Array for each" />
+            <s:Button click="test11()" />
+        </s:VGroup>
+    </s:HGroup>
+    <s:HGroup>
+        <s:VGroup>
+            <s:Label id="test12Label" text="Loop Vector for and bracket" />
+            <s:Button click="test12()" />
+        </s:VGroup>
+        <s:VGroup>
+            <s:Label id="test13Label" text="Loop Vector for each" />
+            <s:Button click="test13()" />
+        </s:VGroup>
+    </s:HGroup>
+</s:Application>

Propchange: incubator/flex/whiteboard/frishy/FastGroupingCollection/src/CollectionTestsLoopObjects.mxml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message