Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code Efficiency Question
Message
De
14/03/2001 20:09:07
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
 
 
À
14/03/2001 19:40:31
Spencer Redfield
Managed Healthcare Northwest, Inc.
Portland, Oregon, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00485113
Message ID:
00485124
Vues:
12
Spencer,

Make some type of minimal form with a minimal field to refresh. Then do this:

lnStartIF = SECONDS()
FOR i = 1 TO 1000
IF SomeCondition
SomeObject.Refresh()
ENDIF
ENDFOR
lnEndIF = SECONDS()

lnStartIIF = SECONDS()
FOR i = 1 TO 1000
IIF(SomeCondition, SomeObject.Refresh(), .F.)
ENDFOR
lnEndIIF

MESSAGEBOX(;
[The IF statement took ] + ALLT(STR(lnEndIF - lnStartIF)) + ;
CHR(13) + ;



>Anyone have a considered response to the following?
>
>Given that in FoxPro an immediate IF, IIF(), is more efficient than an equivalent IF...ELSE, I had a question.
>
>Would this strategy, in fact, actually be more efficient in conditionally calling a form method. For example, would
>
> =iif( SomeCondition, SomeObject.Refresh(), .F. )
>
>have some efficiency advantage (however trivial) over
>
> if ( SomeCondition )
> SomeObject.Refresh
> endif
>
>I fully appreciate that likely of greater concern are issues of code readability, maintainability, etc. than negligible speed improvements.
>My question is really just for a point of knowledge. Thanks.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform