For what it's worth, I just ran some tests reading a 4MB file, looping
through line by line and performing some simple math (cnt = cnt + 1)
The java method was CONSISTENTLY around 375ms on my server. I hit
reload like 30 times and it was never below 350ms and never above 500ms,
and almost always below 400ms.
Using CFFILE, it was much more erratic... coming in as low as 450ms but
often coming in at 2000ms and higher.
Rick
Rick Root wrote:
> Sorry, Matt, I didn't read close enough either! There are threads out
> there also relating to READING large files.
>
> However, I'd probably also suggest looking into using the java file I/O
> stuff to avoid the issues relating to load a 100MB file into memory and
> dealing with it.
>
> Because I love writing java code in CF, I wrote some sample code for
> you, and even tested it.
>
> <cfscript>
> srcFile = "E:\Inetpub\ajaxCFC\documentation\license.txt";
> // create a FileReader object
> fr = createObject("java","java.io.FileReader");
> // Call the constructure with the source file path
> fr.init(srcFile);
> // create a BufferedReader object
> br = createObject("java","java.io.BufferedReader");
> // call the constructor with the FileReader as the arg
> br.init(fr);
> // read the first line
> str = br.readLine();
> // loop ... str will be undefined if there are no more lines
> while (isDefined("str")) {
> // do stuff with the string
> writeOutput(str);
> // read the next line so we can continue the loop
> str = br.readLine();
> }
> // close the buffered reader object
> br.close();
> </cfscript>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:246349
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4