As mentioned before, I'm playing with some code and looking at what happens in
different situations. 3 additional things that I just tested deal with setting
variables:
1. There is no speed difference between using CFSET to set a variable and using
CFSCRIPT to do so. This is true for setting a single variable as well as setting
multiple variables. I prefer to use CFSCRIPT when setting multiple variables as
I think it looks cleaner, but the choice is yours. It's all style.
2. There is no difference between setting a variable to the value of another
variable with or without pound signs. The following all work at about the same
speed.
<CFSET name=url.name>
<CFSET name=#url.name#>
<CFSET name="#url.name#">
Again, the issue is proper formatting and style. This means that the first CFSET
is the better one syntactically.
3. Setting a variable to a combination of text and dynamic data can be done by
setting the dynamic data within the string OR by concatenating it all together.
Both are about the same speed.
<CFSET time="The time is now "&timeformat(now())&" on "&dateformat(now())&".
Your index is "&i>
<CFSET time="The time is now #timeformat(now())# on #dateformat(now())#. Your
index is #i#">
This is where things get tricky style wise. According to older styles and most,
if not all of the authors (myself included), the first style is the better one.
The question is, which do you want to use.
Bottom line is that almost anything done in the past to make a CFSET faster is
now obsolete and the only reason to really use one type of CFSET over another is
style and readability.

Michael Dinowitz
Master of the House of Fusion
http://www.houseoffusion.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to