This is directly from the Knowledge base on macromedia.

CFOUTPUT vs. CFLOOP

Use a CFOUTPUT query instead of CFLOOP query wherever possible. A loop
over a query repeats for every record in the query result set. The
CFLOOP results are just like a CFOUTPUT. During each iteration of the
loop the columns of the current row will be available for output. The
advantage of using CFLOOP instead of a CFOUTPUT is that you can use any
CFML tag within a CFLOOP. CFOUTPUT is restricted to a limited number of
tags to increase its performance. 

http://www.macromedia.com/v1/Handlers/index.cfm?ID=2497&Method=Full

______________________
steve oliver
atnet solutions, inc.
http://www.atnetsolutions.com


-----Original Message-----
From: Steve Oliver [mailto:[EMAIL PROTECTED]] 
Sent: Friday, February 01, 2002 3:58 PM
To: CF-Talk
Subject: RE: Best Practice on using/optimizing cfoutput and cfloops


See I've heard the exact opposite of that.  I used to code like that,
putting cfoutput around everything and using cfloop to loop over the
queries, but after looking over quite a few sites, most of them say
using cfoutput to loop is a lot faster.  

Even in the Allaire knowledge base it said to use cfoutput for looping
through queries.

______________________
steve oliver
atnet solutions, inc.
http://www.atnetsolutions.com


-----Original Message-----
From: Dave Carabetta [mailto:[EMAIL PROTECTED]] 
Sent: Friday, February 01, 2002 3:46 PM
To: CF-Talk
Subject: Re: Best Practice on using/optimizing cfoutput and cfloops


OK, I finally found some explanations in the archives. Careful about the
URL 
wrapping. One thing to keep in mind as I've read through some of the old

posts, I think the answer depends on two things:

1.) CF Server version
Apparently, CF 4.0 and below proved that CFOUTPUT was quicker, but the 
reverse is true for 4.5+.

2.) Size of record set
For small record sets, the difference is negligible. However, for larger

record sets, CFLOOP wins. The links below should expand a bit on this 
thought, especially the first link.

http://www.mail-archive.com/cf-talk@houseoffusion.com/msg54188.html

This one refers to Forta's CF Developer's Study Guide:
http://www.mail-archive.com/cf-talk@houseoffusion.com/msg54029.html


Hope this helps,
Dave.


----Original Message Follows----
From: "Paul Giesenhagen" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
Subject: Re: Best Practice on using/optimizing cfoutput and cfloops
Date: Fri, 1 Feb 2002 12:47:24 -0600

<cfoutput> is much faster than cfloop .... always try to use cfoutput
when
you can.

Paul Giesenhagen
QuillDesign
http://www.quilldesign.com
SiteDirector - Commerce Builder



 > I am wondering if anyone can advise if one practice (below) is more
 > efficient than the other.
 >
 >
 > Practice 1: Enclosing every instance on #variables# in cfoutput tags
 >
 > <body>
 > <cfoutput query="query_name">
 > #query_variable#
 > </cfoutput>
 > </body>
 >
 >
 >
 > VERSUS
 >
 >
 >
 > Practice 2: Enclosing the entire code in a single cfoutput and use
cfloop
 > when necessary
 >
 > <body>
 > <cfoutput>
 > <cfloop query="query_name">
 > #query_variable#
 > </cfloop>
 > </cfoutput>
 > </body>
 >
 >
 >
 > Any advise to demystify any 'performance penalties' would be
appreciated.
 >
 >
 >
 > Thanks,
 >
 > Michael
 >



______________________________________________________________________
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to