I wrote some test code, and it seems that cfif and iif perform similarly,
and sometimes cfif ends up being slower?  Is my test code flawed in some
way?

<cfset startTime=GetTickCount()>
<cfloop from=1 to=100000 index=x>
        <cfoutput>#iif(isDefined("blah"),DE("."),DE(","))#</cfoutput>
</cfloop>
<cfset midTime=GetTickCount()>

<cfloop from=1 to=100000 index=x>
        <cfoutput>
        <cfif isDefined("blah")>
                .
        <cfelse>
                ,
        </cfif>
        </cfoutput>
</cfloop>
<cfset endTime=getTickCount()>
<cfoutput><br>The time to do with IIF is #midtime-starttime#</cfoutput>
<cfoutput><br>Time to do with cfif #endTime-midTime#</cfoutput>

Russ

> -----Original Message-----
> From: Munson, Jacob [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 21, 2006 6:34 PM
> To: CF-Talk
> Subject: RE: iif: am I understanding correctly?
> 
> > This part of the app is not going to take heavy traffic, so
> > the performance
> > hit would be negligible.  However going forward I will always
> > take into
> > consideration the possible performance implications of
> > iif/evaluate/DE.
> 
> Yeah, and another thing to keep in mind when memorizing things that
> perform better performance can change with new versions of CF.  Or if
> you move to a different app server, or different OS.  That's why I said
> I like to test my own code, if I'm worried, because I never believe the
> 'general rules of thumb'.  :)
> 
> 
> ---------------
> 
> This transmission may contain information that is privileged, confidential
> and/or exempt from disclosure under applicable law. If you are not the
> intended recipient, you are hereby notified that any disclosure, copying,
> distribution, or use of the information contained herein (including any
> reliance thereon) is STRICTLY PROHIBITED. If you received this
> transmission in error, please immediately contact the sender and destroy
> the material in its entirety, whether in electronic or hard copy format.
> Thank you. A1.
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247417
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to