Also remember that incrementValue() is slower than using x=x+1 in this type
of scenario and could be slowing it down even more.

-Justin Scott, Lead Developer
 Sceiron Internet Services, Inc.
 http://www.sceiron.com


----- Original Message -----
From: "Marlon Moyer" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 2:25 PM
Subject: Re: cfswitch vs switch


> I also just rewrote the cfscript part using a 'if else if' format and it
> performed in 110ms.  The performance hit of 'switch' is amazing.
>
>
> ----- Original Message -----
> From: "Marlon Moyer" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Friday, April 19, 2002 1:15 PM
> Subject: Re: cfswitch vs switch
>
>
> > I got curious and tested it out for myself.  Here's the results:
> >
> > cfscript switch - 600 ms
> > cfswitch - 181 ms
> >
> > for this code:
> >
> > <cfset time1 = gettickcount()>
> > <cfscript>
> > j = 0;
> > i = 0;
> >
> > for (i = 1;i lte 1000;i=incrementvalue(i)) {
> >  j = RandRange(1,10000);
> >
> >  switch (j) {
> >   case "j lte 250": {
> >    j = j +1;
> >    break;
> >   }
> >   case "j lte 500": {
> >    j=j+1;
> >    break;
> >   }
> >   case "j lte 750": {
> >    j=j+1;
> >    break;
> >   }
> >   case "j lte 1000": {
> >    j=j+1;
> >    break;
> >   }
> >  }
> >
> > }
> >
> > </cfscript>
> > <cfset out = GetTickcount() - time1>
> > <cfoutput>cfscript switch - #out# ms</cfoutput>
> > <cfset time1 = getTickCount()>
> >
> > <cfset j=0>
> > <cfset i=0>
> >
> > <cfloop from="1" to="1000" index="i">
> >  <cfset j=RandRange(1,10000)>
> >  <cfswitch expression="j">
> >   <cfcase value="j lte 250">
> >    <cfset j = j +1>
> >   </cfcase>
> >   <cfcase value="j lte 500">
> >    <cfset j = j +1>
> >   </cfcase>
> >   <cfcase value="j lte 750">
> >    <cfset j = j +1>
> >   </cfcase>
> >   <cfcase value="j lte 1000">
> >    <cfset j = j +1>
> >   </cfcase>
> >  </cfswitch>
> > </cfloop>
> >
> > <cfset out = GetTickcount() - time1>
> > <cfoutput><br>cfswitch - #out# ms</cfoutput>
> > ----- Original Message -----
> > From: "Marlon Moyer" <[EMAIL PROTECTED]>
> > To: "CF-Talk" <[EMAIL PROTECTED]>
> > Sent: Friday, April 19, 2002 12:54 PM
> > Subject: cfswitch vs switch
> >
> >
> > > I seem to remember hearing that the cfscript switch statement is a dog
> > compared to the equivalent cfswitch code...Is this correct?
> > >
> > >
> > > Marlon
> > >
> > >
> > >
> >
> 
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to