Weitere ähnliche Inhalte Ähnlich wie TWaver Flex Performance Report (20) Kürzlich hochgeladen (20) TWaver Flex Performance Report1.
TWaver Flex ®
Performance Report
Nov 2010
Serva Software
info@servasoftware.com
http://www.servasoftware.com
PO Box 8143, Wichita Falls, Texas, USA 76307
2.
For more information about Serva Software and TWaver please visit the web site at:
http://www.servasoftware.com
Or send e‐mail to:
info@servasoftware.com
Nov, 2010
Notice:
This document contains proprietary information of Serva Software. Possession and use of this document shall be strictly in accordance with a license agreement between the user
and Serva Software, and receipt or possession of this document does not convey any rights to reproduce or disclose its contents, or to manufacture, use, or sell anything it may
describe. It may not be reproduced, disclosed, or used by others without specific written authorization of Serva Software.
TWaver, servasoft, Serva Software and the logo are registered trademarks of Serva Software. Java and all Java‐based marks are trademarks or registered trademarks of Sun
Microsystems, Inc. in the U.S.A. and other countries. Other company, brand, or product names are trademarks or registered trademarks of their respective holders. The
information contained in this document is subject to change without notice at the discretion of Serva Software.
Copyright © 2010 Serva Software LLC
All Rights Reserved
3. TWaver Flex Performance Report
Test Environment: TWaver Flex 1.2, Adobe Flash Player 10.1.82.76, Windows XP Professional SP3, Intel Core i5 CPU M540 2.53GHz
Test 1: Loads nodes with image and without links
IE 8.0.6001.18702 Firefox 3.6.9 Chrome 5.0.375.125
Test 2: Loads nodes with image and with 1/5 links
IE 8.0.6001.18702 Firefox 3.6.9 Chrome 5.0.375.125
1
Copyright © 2010 Serva Software All Rights Reserved
4. TWaver Flex Performance Report
Test 3: Loads nodes without image and without links
IE 8.0.6001.18702 Firefox 3.6.9 Chrome 5.0.375.125
Test 4: Loads nodes without image and with 1/5 links
IE 8.0.6001.18702 Firefox 3.6.9 Chrome 5.0.375.125
2
Copyright © 2010 Serva Software All Rights Reserved
5. TWaver Flex Performance Report
Source Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:twaver="http://www.servasoftware.com/2009/twaver/flex"
paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0"
creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.collections.*;
import twaver.*;
[Bindable]
private var memoryUsages:ArrayCollection = new ArrayCollection();
[Bindable]
private var timeUsages:ArrayCollection = new ArrayCollection();
private var box:ElementBox = null;
private var currentStep:int = 0;
private function init():void{
box = network.elementBox;
}
private function test():void{
currentStep++;
var nodeCount:int = int(txtNodeCount.text) * currentStep;
var linkCount:int = this.withLink.selected ? nodeCount/5 : 0;
3
Copyright © 2010 Serva Software All Rights Reserved
6. TWaver Flex Performance Report
var result:Object = loadNode(box, nodeCount, linkCount, withImage.selected, 1000, 1000);
var item:Object = new Object();
item.Count = nodeCount;
item.Memory = result[1];
memoryUsages.addItem(item);
item = new Object();
item.Count = nodeCount;
item.Time = result[0];
timeUsages.addItem(item);
trace(numberFormatter.format(result[0]) + 'ms,' + numberFormatter.format(result[1]) + 'KB');
}
private function reset():void{
box.clear();
System.gc();
}
private static function loadNode(box:ElementBox, nodeCount:int, linkCount:int, useIcon:Boolean, xLimit:int,
yLimit:int):Object{
Styles.setStyle(Styles.CONTENT_TYPE, useIcon ? Consts.CONTENT_TYPE_DEFAULT : Consts.CONTENT_TYPE_VECTOR);
Styles.setStyle(Styles.VECTOR_SHAPE, Consts.SHAPE_CIRCLE);
Styles.setStyle(Styles.VECTOR_FILL, true);
Styles.setStyle(Styles.VECTOR_FILL_COLOR, 0x00FF00);
Styles.setStyle(Styles.VECTOR_OUTLINE_WIDTH, 1);
Styles.setStyle(Styles.VECTOR_OUTLINE_COLOR, 0xFFFFFF);
Styles.setStyle(Styles.VECTOR_GRADIENT, Consts.GRADIENT_RADIAL_NORTHWEST);
4
Copyright © 2010 Serva Software All Rights Reserved
7. TWaver Flex Performance Report
var memoryUsage:int = System.totalMemory / 1024;
var time:Number = new Date().getTime();
for (var nodeIndex:int = 0; nodeIndex < nodeCount; nodeIndex++) {
var node:Node = new Node();
if (!useIcon) {
node.setSize(12, 12);
}
node.setLocation(Utils.randomInt(xLimit), Utils.randomInt(yLimit));
box.add(node);
}
var allNodes:ICollection = box.datas;
var links:Collection = new Collection();
for (var linkIndex:int = 0; linkIndex < linkCount; linkIndex++) {
var node1:Node = allNodes.getItemAt(Utils.randomInt(nodeCount));
var node2:Node = allNodes.getItemAt(Utils.randomInt(nodeCount));
var link:Link = new Link(node1, node2);
link.setStyle(Styles.LINK_WIDTH, 0);
link.setStyle(Styles.LINK_COLOR, 0xFFFF00);
link.setStyle(Styles.OUTER_WIDTH, 0);
link.setStyle(Styles.OUTER_COLOR, 0xFFFFFF);
links.addItem(link);
}
links.forEach(function(link:Link):void{box.add(link);});
return [new Date().getTime() - time, System.totalMemory / 1024 - memoryUsage];
}
]]>
5
Copyright © 2010 Serva Software All Rights Reserved
8. TWaver Flex Performance Report
</mx:Script>
<mx:NumberFormatter id="numberFormatter"/>
<mx:Stroke id = "s1" color="blue" weight="2"/>
<mx:Stroke id = "s2" color="red" weight="2"/>
<mx:VBox width="100%" height="100%" verticalGap="0" horizontalGap="0">
<mx:HBox id="toolbar" top="0" left="0" horizontalGap="0">
<mx:Label id="totalMemory" text="{'Memory:' + numberFormatter.format(System.totalMemory / 1024) + 'KB'}"
render="totalMemory.text = 'Memory:' + numberFormatter.format(System.totalMemory / 1024) + 'KB'"/>
<mx:Label text="Node Count:"/>
<mx:TextInput id="txtNodeCount" width="50" text="500"/>
<mx:Label text="With Image:"/>
<mx:CheckBox id="withImage" selected="true"/>
<mx:Label text="With Link:"/>
<mx:CheckBox id="withLink"/>
<mx:Button id="btnClear" label="Reset" click="reset()"/>
<mx:Button id="btnTest" label="Start Test" click="test()"/>
</mx:HBox>
<mx:HBox width="100%" height="90%" verticalGap="0" horizontalGap="0">
<twaver:Network id="network" width="50%" height="100%"/>
6
Copyright © 2010 Serva Software All Rights Reserved
9. TWaver Flex Performance Report
<mx:VBox width="50%" height="100%" verticalGap="0" horizontalGap="0">
<mx:LineChart id="memoryChart" height="50%" width="100%"
paddingLeft="0" paddingRight="10"
showDataTips="true" dataProvider="{memoryUsages}">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Count" title="Memory Usage (KB)"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="Memory" form="curve" displayName="Memory Usage (KB)" lineStroke="{s1}"/>
</mx:series>
</mx:LineChart>
<mx:LineChart id="timeChart" height="50%" width="100%"
paddingLeft="0" paddingRight="10"
showDataTips="true" dataProvider="{timeUsages}">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Count" title="Time Usage (ms)"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="Time" form="curve" displayName="Time Usage (ms)" lineStroke="{s2}"/>
</mx:series>
</mx:LineChart>
</mx:VBox>
</mx:HBox>
</mx:VBox>
</mx:Application>
7
Copyright © 2010 Serva Software All Rights Reserved