Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why is 2nd file-to-array is 10x slower
Message
De
04/02/2011 14:51:54
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Why is 2nd file-to-array is 10x slower
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01498822
Message ID:
01498822
Vues:
134
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform