Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which is faster: array or cursor?
Message
De
10/03/2009 07:31:58
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
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:
01386854
Vues:
104
>>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.

Rigth. Furthermore depending on what the job would do, what type of variables, results etc it is also possible that VFP is not the good choice for it. Saying needs fast processing of 1000 elements reminds me of scientific calculations which a link to an F# COM dll might be the best choice, gaining both speed and higher accuracy. Basically with 1000 elements I would say within VFP array would be faster. If it is something like splitting a words collection then neither array nor the cursor os the fastest thing in VFP but strangely a UI object - combobox.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform