Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fastest way to get a collection of objects into an array
Message
De
22/06/2000 17:06:05
 
 
À
22/06/2000 17:01:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00380481
Message ID:
00383450
Vues:
23
>>>>>Daniel -- I am not aware of a native function to handle this, but one note that may help: your code will run more quickly if you declare a local array, do all the adding into that array, and then coppy that array at the end into the form level array. VFP is relatively slow at moving data into and out of form-property arrays, at least compared to local arrays. Even the later ACOPY probably won't cost you as much time as you will save with a local array.
>>>>
>>>>You're correct it is about 50% slower to populate a array that is a property vs populating a local array. However, for 60K elements each it's only about the difference between .115 seconds for a local array vs .170 seconds. Rather insignificant IMHO.
>>>
>>>Good point.
>>
>>That's not to say there might be times that this knowledge would be useful. If you're doing this in a loop, the "insignificant" amount of time might still add up to a substantial number. But in this case, a one-shot deal, it's probably a wasted effort. Afterall, you can only split a frog hair so fine. :)
>
>
>About 2000 elements in the array, once it's built. I was actually able to measure a (negligible) difference between redimesioning the array to add each element, and having it predefined larger, and only redimensioning at the end.
>
>Thanks.

Ahh. That's very different. What you're actually measuring there is the time to expand the array's size, not just populating it. But even in that case, you'd still spend a similar amount of time expanding the "local" array vs the "property" one, even if it is faster. Maybe quicker to have a "full sized" array, populate it, and then cut it back to the "actual size" at the end?
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform