Douglas Brown wrote:
> Yes, but you also have to take performance into consideration
[... 0.811 ms vs. 0.370 ms ...]
I would say that that is not significant (especially since on the system
I tested both these numers are a sugnificantly lower). Just switching to
cfqueryparam probably has more influence (apart from the other advantages).
I would even go further and add some more overhead to improve
readability and use a UDF. A UDF that is a combination of an
IsDefined(), a Len() and possibly an IsNumeric() or an IsDate() (example
code below).
10000 iterations, Duron 800.
expression ms ms/iteration
Len(myString) 150 0.015
myString NEQ "" 160 0.016
vIs("myString") 480 0.048
So every 30 Len() statements saves a milisecond over 30 vIs()
statements. I can live with that. But as usual, YMMV.
Jochem
--
Mind the wrap:
<cfscript>
// vIs(variableName [, type [, minimum , maximum]])
// specific to the variables scope
function vIs(theVar) {
if (IsDefined(theVar) and Len(variables[theVar]) neq 0) {
if (ArrayLen(Arguments) eq 1)
return TRUE;
else {
switch(Arguments[2]) {
case "date": {
if (IsDate(variables[theVar]))
return TRUE;
return FALSE;
}
case "numeric": {
if (IsNumeric(variables[theVar])) {
if (ArrayLen(Arguments) eq 2)
return TRUE;
else
if (variables[theVar] gte Arguments[3] and
variables[theVar] lt Arguments[4])
return TRUE;
return FALSE;
}
return FALSE;
}
default:
return FALSE;
}
}
}
return FALSE;
}
</cfscript>
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists