[thelist] CF: Error Trapping: Tip & RFC

jeff jeff at members.evolt.org
Wed Jan 10 22:40:28 CST 2001


: From: Joshua OIson
: In case it hasn't been said before, cfparam is MUCH
: slower than cfset.
: Think about what cfparam has to do to 1) parse your
: string for a variable name, 2) check to see if the
: variable exists, 3) set it to the value you set.

at what expense though?  does the initial overhead of checking to see if a
variable is defined and then setting it to a value if it isn't worth it
compared to just using cfparam?  (not to mention how much more work that is
and how much more difficult it is to maintain.)  i mean take this example:

<cfif NOT IsDefined("form.checkbox")>
  <cfset form.checkbox = 0>

yuck, compared to this:

<cfparam name="form.checkbox" default="0">

especially when you're got a lot of variables and default values to handle
like this.

: cfset is much much faster.  Please note, this is just a
: general aside, and I think your tip was wonderful.

and fwiw, if you're setting multiple variables, then it's much faster to do
it within a cfscript block.



mailto:jeff at members.evolt.org

More information about the thelist mailing list