I owe u a cold one for that...50% less memory usage. :-)

In the case where I'm emailing a CSV, I don't imagine there's much I can
do...(hope I'm wrong)

<cfsetting enablecfoutputonly="yes" showdebugoutput="no">

            <cfsavecontent variable="request.filecontent">

<cfoutput>#title##chr(10)##chr(10)##getData.columnlist##chr(10)#</cfoutp
ut>

                        <cfloop query="results">

                                    <cfset x = 0>

                                    <cfloop list="#results.ColumnList#"
index="column">

                                                <cfset x = x + 1>

                                                <cfoutput>"#Replace(
Evaluate( column ) , '"' , ' ' , 'ALL' )#"<cfif x NEQ ListLen(
results.ColumnList )>,</cfif></cfoutput>

                                    </cfloop>

                                    <cfoutput>#chr(10)#</cfoutput>

                        </cfloop>

            </cfsavecontent>

</cfsetting>

<cffile action="" file="#filepath#" output="#request.filecontent#"
addnewline="Yes">

I originally had it looping over CFFILE but it was painfully slow...I
guess with the large number of file I/O's...this one stores in request
and makes single cffile dump at the end.

Stace

  _____  

From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
Sent: October 4, 2003 12:05 PM
To: CF-Talk
Subject: Re: Can this be optimized?

Stacy Young wrote:
>
> It's not often I nitpick in the sake of 'supreme optimization' but in
> this case it's necessary. I'm using the following code snippet to
> generate CSV file for different queries. The process is usually quite
> memory intensive, wondering if anyone with fresh pair of eyes can
point
> out any items that can be done differently. Speed is not so much an
> issue, it's quite fast...but for larger recordsets it eats mega RAM.

Have you tried using cfflush?

Jochem

  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to