Unscientific...for giggles...take it or leave it...difference is about 0.01
ms per loop iteration:

253 ms:

<cfset thelist =
"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26">

<cfset starttick = gettickcount()>

<cfloop index="i" from="1" to="10000">
<cfset element1 = listgetat(thelist, randrange(1, listlen(thelist)))>
<cfset element2 = listgetat(thelist, randrange(1, listlen(thelist)))>
<cfif isnumeric(element1) and isnumeric(element2)>
<cfoutput><p>#evaluate(element1 + element2)#</p></cfoutput>
</cfif>
</cfloop>

<cfoutput><p>tick #evaluate(gettickcount() - starttick)#</p></cfoutput>

375 ms:

<cfset thelist =
"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26">

<cfset starttick = gettickcount()>

<cfloop index="i" from="1" to="10000">
<cfset element1 = listgetat(thelist, randrange(1, listlen(thelist)))>
<cfset element2 = listgetat(thelist, randrange(1, listlen(thelist)))>
<cftry>
<cfoutput><p>#evaluate(element1 + element2)#</p></cfoutput>
<cfcatch><!--- error caught ---></cfcatch>
</cftry>
</cfloop>

<cfoutput><p>tick #evaluate(gettickcount() - starttick)#</p></cfoutput>

On Fri, Apr 22, 2011 at 11:49 AM, Brook Davies <cft...@logiforms.com> wrote:

>
> I was under the impression that throwing and catching an exception added
> some overhead.  If not, then the function call isBase64() should work
> great.
> Thanks Jon/Dave...
>
> Brook
>
> -----Original Message-----
> From: Dave Watts [mailto:dwa...@figleaf.com]
> Sent: April-22-11 9:37 AM
> To: cf-talk
> Subject: Re: check for a base64 encoded string
>
>
> > Reason being that throwing exceptions are expensive and also an ugly
> > way of programming an evaluation. IMHO..
>
> Throwing exceptions isn't especially expensive, compared to whatever
> conditional logic they might otherwise replace. The ugliness thing is more
> a
> matter of the eye of the beholder, but there's nothing inherently wrong
> about using an exception to test failure.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> http://training.figleaf.com/
>
> Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule,
> and provides the highest caliber vendor-authorized instruction at our
> training centers, online, or onsite.
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343905
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to