On 4/11/07, Claude Schneegans <[EMAIL PROTECTED]> wrote:
>  >>How about if you listLast the Rightmost, say 100, characters?
>
> That was the idea. I'd be curious to know if there is a significant
> difference in performance.

That's super easy to determine.

The following code shows that the listLast() method is *FAR* slower
than the rightmost chars method.

I read a file of 1800 lines, about 73kb... and performed both methods
10,000 times each.. the listLast method completed in around 5.5
seconds.  The rightmost chars method completed in 80 MILLIseconds.

<cffile action="READ" file="#ExpandPath(".")#\test.txt" variable="tempvar">

<cfoutput><p>File size:  #len(tempvar)# characters.</p></cfoutput>
<cfset startTime = now().getTime()>
<cfloop from="1" to="10000" step="1" index="i">
        <cfset foo = listLast(tempvar,chr(10))>
</cfloop>
<cfset endTime = now().getTime()>
<cfoutput><p>ListLast method completed in #endTime-startTime# ms.</p></cfoutput>

<cfset startTime = now().getTime()>
<cfloop from="1" to="10000" step="1" index="i">
        <cfset foo = right(tempvar,100)>
</cfloop>
<cfset endTime = now().getTime()>
<cfoutput><p>Rightmost chars method completed in #endTime-startTime#
ms</p></cfoutput>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274995
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to