Yes, there would be improvement ... noticable?  probably not ... but 10 ms
here 40 ms there over and over can add up to a better performing
application.

I would go with it

Just my .02

Paul Giesenhagen
QuillDesign
----- Original Message -----
From: "Vishal Narayan" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, June 26, 2002 2:49 AM
Subject: <Cfswitch> <cfcase> vs. <elseifs> performancewise


> Our site has around15-20 different e-mails (all dynamically generated)
that
> are triggered off based on different user actions, such as registration,
> unsubscribing etc. All the e-mails on our site are being sent out using
one
> single template, i.e. the template is called using cfmodule with an
> attribute identifying the type of email, and any other attributes that may
> be required. A sample call may look like this :
>
> <cfmodule template="mailingtemplate.cfm" mailtype="FirstReg"
cnd_id="#cnd_id#">
>
>
> The template mailingtemplate.cfm looks like this :
>
>
> <cfset mailtype="#attributes.mailtype#">
>
> <cfif mailtype is "NewCand">
>
> <!--- Dynamically generate email  and send it out--->
>
> <cfelseif mailtype is "FirstReg">
>
>   <!--- Dynamically generate email  and send it out--->
>
> <cfelseif mailtype is "NewApply">
>
> <!--- Dynamically generate email  and send it out--->
>
> <cfelseif mailtype is "NewCandAdmin">
>
> <!--- Dynamically generate email  and send it out--->
>
> ----- and so on ---
>
> </cfif>
>
> This template may have about 15-20 else if conditions. Would there be any
> improvement in performance if we were to use <cfswitch> <cfcase> instead ?
> The template would then then look like this:
>
> <CFSWITCH mailtype="#attributes.mailtype#">
>
> <CFCASE VALUE="NewCand">
> <!--- Dynamically generate email  and send it out--->
> </CFCASE>
>
> <CFCASE VALUE="FirstReg">
> <!--- Dynamically generate email  and send it out--->
> </CFCASE>
>
> -- and so on --
> <CFDEFAULTCASE>
> <!--- Do nothing --->
> </CFDEFAULTCASE>
>
> </CFSWITCH>
>
>
> Vishal.
>
> 
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
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