Don't get me wrong, there are sometimes you can't avoid using the Evaluate() function... and I only use it after exhausting all other possibilites. I can't reference anywhere in particular, but I've read several articles that talk about Evaluate() being one of the slowest functions in ColdFusion. I would use Val() for math functions in place of Evaluate... but even then, I would avoid using Val() also.
Don't take my word for it, try this bit of code below that shows the different speed of Normal, Val(), and Evalute() functions.
[COLOR=666666]<!--- If you change this from 100 to 500,
it will break Evaluate() --->[/color]
<CFSET vLoop = 500>
[COLOR=666666]<!--- Test Normal Speed --->[/color]
[COLOR=000080]<B>[/color]Normal:[COLOR=000080]</B>[/color][COLOR=000080]<BR>[/color]
<CFSET vNumber = 1>
<CFSET start = GetTickCount()>
<CFLOOP FROM="1" TO="#VARIABLES.vLoop#" INDEX="i">
<CFSET vNumber = VARIABLES.vNumber * i>
</CFLOOP>
<CFSET end = GetTickCount()>
<CFSET time = VARIABLES.end - VARIABLES.start>
<CFOUTPUT>
#VARIABLES.time# milliseconds[COLOR=000080]<BR>[/color]
vNumber=#VARIABLES.vNumber#
</CFOUTPUT>
[COLOR=000080]<BR>[/color]
[COLOR=000080]<BR>[/color]
[COLOR=666666]<!--- Test the speed of Val() --->[/color]
[COLOR=000080]<B>[/color]Val():[COLOR=000080]</B>[/color][COLOR=000080]<BR>[/color]
<CFSET vNumber = 1>
<CFSET start = GetTickCount()>
<CFLOOP FROM="1" TO="#VARIABLES.vLoop#" INDEX="i">
<CFSET vNumber = Val(VARIABLES.vNumber * i)>
</CFLOOP>
<CFSET end = GetTickCount()>
<CFSET time = VARIABLES.end - VARIABLES.start>
<CFOUTPUT>
#VARIABLES.time# milliseconds[COLOR=000080]<BR>[/color]
vNumber=#VARIABLES.vNumber#
</CFOUTPUT>
[COLOR=000080]<BR>[/color]
[COLOR=000080]<BR>[/color]
[COLOR=666666]<!--- Test speed of Evaluate() --->[/color]
[COLOR=000080]<B>[/color]Evaluate():[COLOR=000080]</B>[/color][COLOR=000080]<BR>[/color]
<CFSET vNumber = 1>
<CFSET start = GetTickCount()>
<CFLOOP FROM="1" TO="#VARIABLES.vLoop#" INDEX="i">
<CFSET vNumber = Evaluate(VARIABLES.vNumber * i)>
</CFLOOP>
<CFSET end = GetTickCount()>
<CFSET time = VARIABLES.end - VARIABLES.start>
<CFOUTPUT>
#VARIABLES.time# milliseconds[COLOR=000080]<BR>[/color]
vNumber=#VARIABLES.vNumber#
</CFOUTPUT>
On my machine, I average the following output:
Normal:
20 milliseconds
vNumber=7.3621402796E+127
Val():
60 milliseconds
vNumber=7.3621402797E+127
Evaluate():
120 milliseconds
vNumber=7.3621402797E+127 - tleish