> "Use <cfscript> Instead of Three or More <cfset>s The reason > is this: When you use cfscript, the entire block gets sent to > the engine at once. So, ColdFusion has to make only one read. > When you send three or more <cfset> statements, ColdFusion > gets to interpret them once each, or three times. Therefore, > it's faster and cleaner." > > From: http://www.informit.com/articles/article.aspx?p=24131&seqNum=3
That article was written in 2001, prior to the release of CFMX. CFMX executes code in a completely different manner than its predecessors, and any "which is faster" information written for earlier versions should be read with that in mind. > " Always use cfscript for blocks of variable assignments for > values greater than one. It is significantly faster than cfset. > > Example: <cfscript> a=1; b=2; c=3; </cfscript> > Not: <cfset a=1> <cfset b=2> <cfset c=3>" Faster != significantly faster. You would be hard-pressed to see significant differences between CFSCRIPT and CFSET for variable assignment even with CF 4 and 5. You could buy a couple of milliseconds that way, perhaps, but that's it, and you'd need more than three variables to see even those differences. > While it may not be true for CFMX 7 & 8 it was a documented > best practice for CF 5 and back. I've continued to use this > method, especially when declaring multiple variables. It was considered by many as a best practice in the single case of variable assignment. For anything else, it could be the same or worse than using CFML. But even with variable assignment, the difference was usually minimal and insignificant to the performance of your application under load. To say that "CFScript should be a bit faster as CF processes the CFScript block all at once" - your original statement - is neither accurate as stated nor a best practice at any point in CF's history. I'm not trying to pick on you or Ravi, but as a best practices consultant I'm very sensitive to what are, in my opinion, incorrect statements about best practices. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Training: Adobe/Google/Paperthin Certified Partners http://training.figleaf.com/ WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers! http://www.webmaniacsconference.com/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:303346 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4