Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
FCS FCS is offline
external usenet poster
 
Posts: 8
Default Improving File Writing speed

I would like to improve the speed of my code. It generates an output file
for the results in CSV format which may be very large (10-200MB). Each line
of the output file contains a record which is calculated and written
sequentially using WRITE #.
I would like to improve the speed of this process by improving the speed of
the File Output which seems to be the main bottleneck.
I thought about "writing to memory" and then dumping results in big chunks
at regular intervals could improve the speed but I am not sure how to
implement it to respect the CSV formatting that I am getting using the WRITE
# command.

Any suggestions, ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Improving File Writing speed

Care to share some code and/or timings? You don't say how long the process
takes right now, so it's difficult to imagine how much improvement could be
made.

I seem to recall comparing file creation speeds between either building up
the file as a huge string in memory and writing it in one shot, versus
writing out each line directly to the file. Writing line-by-line was
faster. Note if you want to stry building up a large string before writing
it out then you should avoid repeated concatenations and instead use a
"string builder" class to handle it.
Eg:
http://www.vbaccelerator.com/home/Vb...er/article.asp

It's not so difficult to create a CSV-formatted line: just separate your
fields with a comma and wrap any content containing a literal comma in
quotes.

Tim

"FCS" wrote in message
...
I would like to improve the speed of my code. It generates an output file
for the results in CSV format which may be very large (10-200MB). Each
line
of the output file contains a record which is calculated and written
sequentially using WRITE #.
I would like to improve the speed of this process by improving the speed
of
the File Output which seems to be the main bottleneck.
I thought about "writing to memory" and then dumping results in big chunks
at regular intervals could improve the speed but I am not sure how to
implement it to respect the CSV formatting that I am getting using the
WRITE
# command.

Any suggestions, ideas?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Speed of file opening Mike Milmoe Excel Discussion (Misc queries) 14 October 19th 07 06:50 AM
Improving Recalculation Speed for Complex Links Andrew Excel Discussion (Misc queries) 0 November 7th 06 09:29 AM
Improving the speed of FOR/NEXT statements andycharger[_14_] Excel Programming 3 February 17th 04 09:49 AM
Excel Writing speed Stef[_2_] Excel Programming 2 November 5th 03 01:11 AM
Improving speed with VBA Steven Cheng[_2_] Excel Programming 7 October 12th 03 05:37 PM


All times are GMT +1. The time now is 05:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"