Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why is 2nd file-to-array is 10x slower
Message
From
04/02/2011 14:51:54
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Why is 2nd file-to-array is 10x slower
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01498822
Message ID:
01498822
Views:
133
Problem: Reading a file into an array takes ten times longer after the first time the program is run. (Quitting VFP and starting over is the only solution right now.)

The file is about 55MB in size. The program is a simple "PRG" (no forms, no tables, etc.)

Because the file is so large, I found it better to skip reading it into a string and then into an array.

The code is question is at the beginning of the PRG file, after some initial definitions and is:
nStart = SECONDS()
* read file into array
nLines = ALINES(aIn, FILETOSTR(cInputFile))
? 'the time to array = ' + TRANSFORM(SECONDS() - nStart) + ' seconds'
The first time the program is executed, the file reads into the array in 3 seconds. Each time after that it takes 30-40 seconds.

I have tried these things:
CLEAR ALL
RELEASE ALL LIKE *
* purge cached memory
SYS(1104)
DIMENSION aIn[1]
... at the beginning of the program, but there is no difference. I'm wondering if there is a file buffer that needs emptying, but then I'd think the read would get longer each time but it's approximately the same for every execution after the first.

Suggestions please -- including different ways to approach this application.
Next
Reply
Map
View

Click here to load this message in the networking platform