D=1; Takes 10 seconds?
Boy I am not sure what or how slow your computer is but that code takes like .00100ms for me to run. -----Original Message----- From: harry wang [mailto:[email protected]] Sent: Thursday, 4 February 2010 8:33 PM To: flex Subject: Re: a question about code speed of flex >What exactly are you demonstrating? What I see is that evaluating one >compound expression instead of two simpler expressions is about 12 >times slower. Of course, the actual delta is measured in fractional >microseconds, so it's most likely due to slight variations in your CPU >load at the time of the test, or perhaps the AS VM performing >optimizations part way through the first loop. Did you try the tests >in reverse order? In any case, the difference is WAY too small to >care about in pretty much every situation. > >cheers, >barneyb > > >> I think the difference is very big. It seems AS VM optimization is too bad in the body of a for loop. Here is another test, more simple. static function test(text:TextArea):void{ var loop:int = 0; var i:int = 0; var j:int = 0; var k:int = 0; var now:Date = new Date(); var d:int = 1; for(i=0;i<10;i++){ for(j=0;j<10000000;j++){ d=1; //Comment out this to see difference } now = new Date(); text.text+=(""+now.getTime()+" "+d+"\n"); } } If d=1 is executed it cost 10seconds ,if it not execuetd it cost 1 seconds. Can you try to repeat it on your machine,may be I use some wrong complier options. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/flex/message.cfm/messageid:6259 Subscription: http://www.houseoffusion.com/groups/flex/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37
