>> "#Chr(34)##replace(arguments > > .str,chr(34),"#chr(34)##chr(34)#","ALL")##Chr(34)#"
There is your bottle neck. CF does not like string manipulation on a large scale. I have tried to parsed large text files before only to watched my dev box just keel over. I see two options off the top of my head, let SQL server do the work or use Java for the string manipulation. Last time I had to parse a large text file like this I ended up writting an ActiveX script for DTS (long time ago) . G On Mon, Jun 2, 2008 at 11:19 AM, Rick Root <[EMAIL PROTECTED]> wrote: > On Mon, Jun 2, 2008 at 10:50 AM, Gaulin, Mark <[EMAIL PROTECTED]> > wrote: > > > > > Also, test you page with the user's query but with the output part > > (actually writing the file) commented out... If the page is still slow > > and a huge memory hog then the file stuff above won't help much and > > you'll have to look at running the query in java too, but I but you'll > > get something by handling the file better. > > > > I honestly don't think it's the file writing that's the problem. > > I just commented out the fileWrite() statements inside the <cfloop> tags > that would write each line to the file, (the file still being opened with > the "header" row being written to it... and it made zero difference at all > in the length of time it took to complete. > > The query itself runs quite fast. Returns a lot of rows but isn't a > complex > query. > > Anyway, I put some cfoutput statements in my gateway (I'm calling it as a > direct cfc call not a gateway for testing).. output now().gettime() to see > the ms as the method call progresses. > > The query returns its results in less than 4 seconds. The process of > generating the csv (around line 330-340 of the sample code I posted > earlier) > took 62 of the 68 seconds. > > And that was without actually WRITING the file. > > the GOOD news is that a TAB delimited file takes considerably less time (32 > seconds vs. 68 seconds), cutting the "output time" from 62 seconds to 26 > seconds. Which means the csvFormat() function is taking up a very large > part of the processing time. > > This is my csvFormat() function: > > <cffunction name="csvFormat" output="false" access="public" > returnType="string"> > <cfargument name="str" type="string" required="yes"> > <cfif arguments.str neq "" and not isNumeric(arguments.str)> > <cfreturn > > "#Chr(34)##replace(arguments.str,chr(34),"#chr(34)##chr(34)#","ALL")##Chr(34)#"> > <cfelse> > <cfreturn arguments.str> > </cfif> > </cffunction> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306579 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4