Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which is better IF (!SEEK(UPPER(expr))
Message
From
13/07/2001 11:25:38
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00530269
Message ID:
00530290
Views:
14
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform