While the speed increase is negligible in smaller files...it's up to 65%
faster in beefier reports. :)
Although perhaps a bug in cfmx, I had to do the following:
<cfloop index="x" from="1" to="#ArrayLen( columns )#">
<cfset tempvars = test[columns[x]]>
<cfoutput>"#Replace( tempvars, '"', ' ' , 'ALL' )#"<cfif x
NEQ ArrayLen( columns )>,</cfif></cfoutput>
</cfloop>
If I don't set test[columns[x]] first, it seems cfmx tries to perform
the Replace before properly evaluating test[columns[x]] and throws an
exception about it being a complex value.
Cheers!
Stace
_____
From: Matt Liotta [mailto:[EMAIL PROTECTED]
Sent: October 4, 2003 12:18 PM
To: CF-Talk
Subject: Re: Can this be optimized?
> 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.
>
I don't really see much you can do about the memory issues, but there
is certainly optimization potential that could result in less memory
overhead. The two big issues you have is looping over a list and using
Evaluate(). Below is some modified code that may help you.
<cfset columns = ListToArray(results.ColumnList)>
<cfloop query="results">
<cfloop index="x" from="1" to="#ArrayLen(columns)#">
<cfoutput>"#Replace(results[columns[x]], '"', ' ' , 'ALL'
)#"</cfoutput>
</cfloop>
<cfoutput>#Chr(10)#</cfoutput>
</cfloop>
Matt Liotta
President & CEO
Montara Software, Inc.
http://www.MontaraSoftware.com
(888) 408-0900 x901
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

