Only if you are SURE that the "EOF lines:" is ALWAYS in the last logical
line and within the last 100 chars.

-----Original Message-----
From: Che Vilnonis [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 11, 2007 8:36 AM
To: CF-Talk
Subject: RE: Finding one line of text in a large text file.


Thanks Rick.
So, in the case for my file with 8500 lines... If I get the last 100 chars
and then do a <find> on them, I should be good to go?

Che

-----Original Message-----
From: Rick Root [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 11, 2007 8:58 AM
To: CF-Talk
Subject: Re: Finding one line of text in a large text file.


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>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

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

Reply via email to