Rick,

Nice! ... I love a success story :)

Mark Kruger - CFG
CF Webtools
www.cfwebtools.com
www.coldfusionmuse.com
O: 402.408.3733 x105
E: [email protected]
Skype: markakruger


-----Original Message-----
From: Rick Root [mailto:[email protected]] 
Sent: Thursday, August 18, 2011 10:42 AM
To: cf-talk
Subject: Re: Improving Performance


so, I got two suggestions from this thread that proved worthy..

#1 - someone asked about the need for the .toString() call - apparently, I
don't actually need this.  I ran some tests without it and it worked and
speed things up.

#2 - Someone suggested writing the whole record instead of one field at a
time.  CsvWriter has a writeRecord() method that accepts an array, so I
modified the code to put the values into an array and then use that method
instead.

I was able to improve the performance of an output of 20,000 records from 21
seconds to around 12 seconds with these two changes.


<cfset ArrayClear(local.valuesArray)>
<cfloop from="1" to="#numFields#" index="i" step="1">
     <cfset ArrayAppend(local.valuesArray,
resultSet[fieldsArray[i]][resultSet.currentRow] )>
</cfloop>
<cfset fileOutput.writeRecord( local.valuesArray )>

Thanks all!

Rick



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346838
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to