Jon,

Here's a snippet of a discussion my local CFUG just had on this subject 
(in reverse order so you can read it top down):

On 11/28/06, Eric Knipp <[EMAIL PROTECTED]> wrote:
 > It was my understanding that
 >
 > <cfscript>
 > if (a eq b) { a = c; }
 > </cfscript>
 >
 > is the same performance-wise as
 >
 > <cfif (a eq b)>
 >   <cfset a = c />
 > </cfif>
 >
 > as the CF compiler turns them into the same thing .. I am pretty sure 
there
 > have been other discussions on this topic.  As of CFMX I thought 
there was
 > no performance difference?
 >

On 11/28/06, Phillip Holmes <[EMAIL PROTECTED]> wrote:
 > Nope. Your example may be immeasurable, but with more advanced
 > functionality, that is not the case.
 >
 > Obviously, ColdFusion is middle ware for your middle ware. It is a
 > collection of servlets that consolidate Java functionality into one
 > tidy command. Calling a tag when you can script it out with one
 > cfscript block, simply creates another import and more code in the
 > final JIT. If you write the code in cfscript, it is closer to the end
 > result (Java) than if CF has to import more servlet libraries to get
 > to the final result.
 >
 > Get yourself a java decompiler, write the code both ways in two
 > different files, decompile the JIT, and you'll see what I mean. Most
 > of all, turn your debug times on and look at the difference.
 >
 > --Phillip Holmes

I think it's actually a pretty common practice.

Cheers,
Chris

Jon Gunnip wrote:
> Chris,
>
> I would be wary of using cfscript just for supposed performance gains
> over tags.  My understanding is that those gains were eliminated (or
> reduced to the point of insignificance) in CF 6.x and 7.x.  Here are
> what I see as the pros and cons of cfscript.  These points are largely
> a matter of preference:
>
> Pros of cfscript
> -- more readable
> -- less typing
> -- more like other languages (Java, JavaScript) - sometimes can copy
> Java snippets and they function with little modification in cfscript
>
> Cons
> -- many pieces of cf functionality do not exist in cfscript (e.g.
> throw, dump, abort) or are awkward (looping over queries) - we have a
> CFScript.cfm include with functions like Throw(), Dump(), Abort() to
> get around this, but for cfquery we always use tags
> -- might be inconsistent with other code written in tags; I like to
> see consistency throughout an application
>
> Jon
>
>
>   
>> I was told by some members of my local CFUG that
>> writing code within CFScript tags whenever possible is faster (performance
>> wise), so I'm giving it a go.
>>     
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264266
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to