Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which is better IF (!SEEK(UPPER(expr))
Message
De
13/07/2001 11:25:38
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00530269
Message ID:
00530290
Vues:
13
>Which these two are better,faster,etc.
>
>IF (NOT SEEK(UPPER(expr)))
>...
>ENDIF
> or
>m.var = UPPER(expr)
>IF (NOT SEEK(m.var))
>...
>ENDIF
>
>
>Regards
>Bhavbhuti

I think, too, that the first method is slightly faster, but that it isn't worthwhile to optimize in this case. Use whatever looks more readable to you. Personally, I prefer the first approach. BTW, you can eliminate the outer parentheses in both cases (some other languages require them, but not VFP).

The following piece of code can help you compare the speed of anything you want to test:
lnStart = seconds()
for i = 1 to 10000
  * Do something here
next
? "Option 1:", seconds() - lnStart

* Repeat for Option 2, Option 3, etc.
Regards, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform