On Tue, Oct 19, 2010 at 10:51 PM, Bryan Stevenson wrote: > Respectfully Ketan....your tests have nothing to do with the string > concatenation performance issue that was the crux of this thread ;-)
I very much doubt the performance issue discussed here has anything to do with string concatenation. <cffile action='append'...> appends code to the file on the file system. That means it waits until the data hits the disks. If you pull the plug after 10K lines, you will have a file with 10K lines on the filesystem when it comes back up. With a 15K RPM disk the rotational latency alone limits you to 250 operations per second. So 20K lines takes about 80 seconds. (If you test this you will frequently see higher performance numbers which is due to write caching not in the OS but on the disk. SAS disks typically allow you to disable that.) <cfset this.FileObject.write(arguments.fileData,0, len(arguments.fileData))> doesn't write to disk, it writes to a JVM buffer. Only the final FileObject.flush() writes the buffer to disk. If you pull the plug after 10K lines, you will have a file with 0 lines on the filesystem when it comes back up. That your PHP code runs in about 8 seconds simply means it does string concatenation in memory followed by one write as well. Either explicitly in a PHP memory variable or implicitly by not doing a real fsync after writing to the filesystem. Jochem -- Jochem van Dieten http://jochem.vandieten.net/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:338352 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm