It used to be before - I think - CFMX7 that most CFScript constructs were faster than their tag-based equivalents. And sometimes there was a significant difference. Since then, there really has been nothing, and indeed, CFScript code can sometimes be slower than the closest equivalent in tags. For instance:
for (i=1; i <= myObj.methodReturningTotal(); i++){
vs
<cfloop index="i" from="1" to="#myObj.methodReturningTotal()#"> </cfloop>
They look superficially the same, but tag-based will work quickly because the expression myObj.methodReturningTotal() evaluates each iteration for the for loop, but only once before the loop starts with the version of <cfloop> .
Similarly, looping through lists and queries using <cfloop> is slightly faster than using the combination for / listLen() / listGetAt() for lists and similar manipulations for queries.
Indeed ... using different code constructs will not be a great place to improve performance. The best place to look is to look at your logic to see if it can be improved, and - more likely to see a win - see how your interaction with the database works. Improving your SQL, viewing the correctness of your indexes, etc., will bring you more benefits, because interacting with the database is often the biggest neck of a performance bottle.
Fortunately for you, by the way, for skepticism and doubt about what your fellow CF developers said, without any actual evidence. This is a good way to approach these things and life in general.
source share