Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro that processes a text file, reading data one line at a time.
Originally I did 2 "passes" on the file, the first step merely established the number of lines in the file so that I could use a progress indicator on the next pass through the file where I did my actual processing. Then I got the bright idea that instead of opening and closing the file twice I only needed to do it once and could save considerable processing time. I would open the file, and pass each line to an arrayed variable. After establishing the mumber of lines I would then access the array data instead of opening the file again. To my surprise this ended up saving virtually no time at all. Can anyone explain this ? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perhaps reading a file is not as inefficient as you thought. If you are
filling the array fully, then reading the array, isn't this like reading the file twice? I am curious how much time difference there is between just reading the once vs reading it twice? For small files (< 100's of thousands lines), I would expect the difference to be barely noticeable. Bob "Steve Farrar" wrote in message ink.net... I have a macro that processes a text file, reading data one line at a time. Originally I did 2 "passes" on the file, the first step merely established the number of lines in the file so that I could use a progress indicator on the next pass through the file where I did my actual processing. Then I got the bright idea that instead of opening and closing the file twice I only needed to do it once and could save considerable processing time. I would open the file, and pass each line to an arrayed variable. After establishing the mumber of lines I would then access the array data instead of opening the file again. To my surprise this ended up saving virtually no time at all. Can anyone explain this ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
array question | Excel Discussion (Misc queries) | |||
another array question | Excel Worksheet Functions | |||
vba array question | Excel Programming | |||
array question | Excel Programming | |||
Is this an array question? | Excel Programming |