In the CFSCRIPT portion of our MX Master Class back in 6.0 days, we used to show the differences in Java source code between two identical blocks of logic, one implemented in CFML and the other implemented in CFSCRIPT. You quickly understood why CFSCRIPT was faster: ColdFusion Server placed each translated CFML tag within its own "do while" loop in the Java source code, but placed the entire block of translated CFSCRIPT logic within a single do while loop.
The compiler changed significantly with 6.1 and you can no longer check a checkbox to tell it to generate Java source code anymore (I don't know if there's a config file setting, though), so I don't know if ColdFusion still does this under the covers. It's supposed to be much more efficient now. The things people mentioned in this thread regarding whitespace is also significant, but there is something even more significant to execution speed for the first execution of a page: parsing CFML tags. Parsing a stack of tag calls takes time. A CFSCRIPT paired tag encloses an entire body of logic that, because it strictly terminates each line with a semicolon, is essentially a single semicolon-delimited list of commands that can be directly processed by the CFSCRIPT scripting engine. With any luck the differences, if there even are any remaining in 6.1, will be eliminated in future versions of ColdFusion. The basic bottom line is that you should code according to your instincts. Paraphrasing what Kevin said, "If it feels like CFSCRIPT, code it in CFSCRIPT." If anyone wants to cobble together some significant logic using both methods, we'll bench both of them in our load testing lab and let the numbers tell the story. Just let me know. Respectfully, Adam Phillip Churvis Member of Team Macromedia Advanced Intensive Training: * C# & ASP.NET for ColdFusion Developers * ColdFusion MX Master Class * Advanced Development with CFMX and SQL Server 2000 http://www.ColdFusionTraining.com Download CommerceBlocks V2.1 and LoRCAT from http://www.ProductivityEnhancement.com The ColdFusion MX Bible is in bookstores now! ----- Original Message ----- From: "Kevin J. Miller" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, October 03, 2004 4:54 AM Subject: [CFCDev] OT: cfscript vs cfml CFMX 6.1: I have a routine for parsing some log files that is heinously slow (string parsing being arguably never one of cf's strengths if memory serves). To make a long story short I did the routine almost entirely in cfscript, it just *felt* more cfscript-y and so I did it this way (it also only took me an hour to write, vs a couple days in an alternate method - see final note). After showing it to another developer he asked why I did it in cfscript vs. cfml. I answered as before, 'it just felt more like a cfscriptish routine', followed by 'and so what, if cf is all compiled to servlets why should it matter if something is done cfscript vs cfml?'. His reply was that he had read/heard that while cfml is compiled to java, cfscript is left intact and is interpreted by 'cf tags' at runtime. Can anyone confirm this? While its certainly known that there are speed differences between some cfml/cfscript implementations of the same thing, I hadn't given it much thought after moving to MX (see www.developer.be 's benchmarking articles for more). BTW, I'm redoing the routine as a sql server DTS, so while I don't really need any suggestions on resolving my speed issue (it's a one or two time thing at most), I *am* curious if the statement regarding compilation of cfscript, or lack thereof, is accurate. TIA Kevin ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]