Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which is faster: array or cursor?
Message
De
10/03/2009 06:34:00
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01386748
Message ID:
01386842
Vues:
101
>If I had 1000 values that I need to loop through (visit every node sequentially, not skip around) that needed very fast processing and they do not need disk storage... which would be faster... an array or a cursor?

First, the sample speed test code given in this thread does show that at 1,000 records x 100,000 iterations your get a 2 or 3 second speed improvement over the array (less if you use m. prefix). But this works out to just a tiny seconds-per-iteration improvement - a meaningless difference considering that within any loop there will probably be other processing going on which will have a far greater impact than this.

Second, if you change the array to hold character data 100 chars long and the cursor to hold a char field 100 chars in length then the difference essentially disappears.

The decision as to which option to use should not be based on this relatively meaningless performance test but rather on which option provides you with the best functionality (and maintainability) for the job at hand.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform