Running 4.51 sp1 I get the same results. Both cfscript loops are on average
faster than the cfloop loops after the page has been run a couple of times.
The first couple of times the cfloop is faster for some reason.
Here is my page with the below code

http://216.54.222.28/cfscript.cfm

jon
----- Original Message -----
From: "Michael Dinowitz" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, January 11, 2001 6:26 PM
Subject: (code) Looping is faster in 4.5.2


> In the past both myself and many others have written and said how CFLOOP
is
> faster and more efficient than the loops within CFSCRIPT. I was just doing
> some tests and found that this is no longer true. It seems that as of CF
> 4.5.2, CFSCRIPT loops are the more efficient loops with the for loop
looking
> slightly better than the while loop. These are my findings, but I'd like
> others to play with this as well and give me their results. Below is my
test
> code. Each section is as exact in comparison to the others as I can make
it.
>
> <CFSET start=GetTickCount()>
> <CFSCRIPT>
>  i=1;
>  While (i LTE 1000){
>   test=i;
>   test2=test+i;
>   i=i+1;
>  }
>  WriteOutput(test);
> </CFSCRIPT>
> <BR>
> While: <CFSET WriteoutPut(gettickcount()-start)>
> <BR>
>
> <CFSET start=GetTickCount()>
> <CFSCRIPT>
>  for(i=1; i LTE 1000; i = i + 1){
>   test=i;
>   test2=test+i;
>  }
>  WriteOutput(test);
> </CFSCRIPT>
>
> <BR>
> For: <CFSET WriteoutPut(gettickcount()-start)>
> <BR>
> <CFSET start=GetTickCount()>
> <CFLOOP from="1" to="1000" index="i">
>  <CFSET test=i>
>  <CFSET test2=test+i>
> </CFLOOP>
> <CFSET WriteOutput(test)>
> <BR>
> CFLoop: <CFSET WriteoutPut(gettickcount()-start)>
> <BR>
>
> Michael Dinowitz
> Publisher: Fusion Authority weekly news alert
> (www.fusionauthority.com/alert)
> Listmaster: CF-Talk, CF-Jobs, Spectra-Talk, Jrun-Talk, etc.
> (www.houseoffusion.com)
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to