Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Side by side comparison (strings & local data)
Message
De
28/12/2003 01:44:55
 
 
À
28/12/2003 01:32:12
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
00861648
Message ID:
00862317
Vues:
31
>>Hi Dragan. Would you please explain why creating and compiling a seperate prg is faster? Thanks.
>
>Because it compiles only once. ExecScript() compiles each time (unless we include scan/endscan inside it so it runs only once), and evaluate() has to do the lookup of the expression for each field, for each record.
>
>Writing a simple .prg generator makes much more sense when we have to do some special selection among the fields. I once had an import procedure which brought over the same 1000 records times about 128 fields over and over, in case there was an update somewhere. There were several classes of records (same structure, but not all the fields were involved each time), and the structure of these records was guaranteed only for some of the columns - the others may or may not be there. So instead of checking for each field on each record, I generated a routine which would do the conversion for the fields present. My calculation turned out that this has saved me some 40000 IF statements per run. And it was about 60 times faster from the original version, and about 3 times faster than my last version before that.


Thanks Dragan!
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
Répondre
Fil
Voir

Click here to load this message in the networking platform