Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro Substition Idea
Message
De
23/02/2006 23:39:43
 
 
À
23/02/2006 18:20:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01098713
Message ID:
01098770
Vues:
9
>Macro are a good idea, slows the execution of the code. When a macro is encountered, value of the variable is substituted, and the entire line is compiled before it is executed. The Evaluate() function performs faster then Macros, because the expression is the only thing being evaluated at runtime.

You probably meant
dAirDate1 = eval(m.cAlias+".AirDate")
instead of
dAirDate1 = eval(&cAlias+".AirDate")
as a replacement for
dAirDate1 = &cAlias..AirDate
but for the particular UC the fastest way is
Store (m.cAlias+".AirDate") to dAirDate1
.
But in most cases on today's machines even macroexpansion is not a big drag: just calling a method carries about the same overhead. Finding the correct algorithm/data/table structure gives usually better perf than micro-optimizations like that - most of the time they are premature optimizations. About the only case where such an exchange made a clear difference was substituting it in the generic get/setprop methods of a "homegrown" framework I was asked to optimize, which were called a couple of thousand times at recurring times like start, save and so on (yeah, I reduced the number of calls as well <g>).

my 0.02 EUR

thomas
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform