My money is on "if you care about the nanoseconds that processing CFOUTPUT
tags, don't use CF, because it's obviously too slow as a whole".  Also, the
"parse the whole file" thing has no weight on CFMX, because the template
gets compiled only once (unlike CF5 and below).

However, I did some testing, using a user information form that get
prepopulated from a structure of user data.  I copied the form directly out
of an application (with a single CFOUTPUT) into a standalone file.
Duplicated it and individually wrapped every variable output with it's own
CFOUTPUT tag (removing the global one, of course).

The test script set up all the needed variables, then included each file
once, and then timed 500 iterations of including the file:

<cfinclude template="_one.cfm" />
<cfinclude template="_indv.cfm" />

<cfset start = gettickcount() />
<cfloop from="1" to="500" index="i">
<cfinclude template="_one.cfm" />
</cfloop>
<cfset - start />

<cfset start = gettickcount() />
<cfloop from="1" to="500" index="i">>
<cfinclude template="_indv.cfm" />
</cfloop>
<cfset indv = gettickcount() - start />

The results were wishy-washy.  A third of the time, the results were within
a few milliseconds (500-600 total).  The rest of the time, there was a huge
difference (150ms vs 650ms), with each version being the faster one about
equally.

Based on that, I'd say performance shouldn't influence your decision.
Personally, I think that wrapping all outputted content in CFOUTPUT is a lot
cleaner (less tags in the code), and it also lets you know that you ALWAYS
have to escape hashes, and that you NEVER have to add tags if you want to
output a variable.  That's opinion, of course.

Cheers,
barneyb

> -----Original Message-----
> From: Wes [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 20, 2004 10:35 AM
> To: CF-Talk
> Subject: RE: single vs. multiple cfoutputs in CFMX
>
> Ben Forta explained this in a CFUG a couple years or so back.
>  He said that
> it was more efficient to have CFOUTPUTS around each variable
> output rather
> than the entire page because otherwise, the CF server looks at EVERY
> character from top to bottom of your page looking for a # and
> then it's end
> #.
>
>  
>
> That same year, I attended a class with Steve Drucker and his
> explanation of
> that same issue was that it is more efficient for wrap your
> entire page in
> one single OUTPUT tab because the CF server did not have to
> sort through
> many CFOUTPUT requests.
>
>  
>
> My money is on Forta. but, I would like to see a stress test
> that proved one
> way or the other.
>
>  
>
> Wes
>
>  
>
> -----Original Message-----
> From: Michael Dinowitz [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 20, 2004 12:09 PM
> To: CF-Talk
> Subject: single vs. multiple cfoutputs in CFMX
>
>  
>
> Has anyone done any recent tests in CFMX on the speed difference
> between one global output around a template vs. multiple CFOUTPUTs
> around specific content in a page? If not, it'll go on my testing
> list.
> Thanks
> --
> Michael Dinowitz
> http://www.houseoffusion.com
> For all your ColdFusion needs
>
>   _____  
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to