Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN vs. FOR
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00135531
Message ID:
00135568
Views:
10
>>Bruce ---
>>
>>>I'm a little surprised to find that FOR is faster than SCAN (in applicable situations) in some tests I did in vfp6. The old rule was the other way around, I believe...
>>
>>It was the other way around. Are you running VFP6 production version?
>
>No, I'm still on beta...but we had a thread a while back, as I recall, in which speed order was SCAN, FOR, WHILE (with WHILE a distant third). I'd just accepted this as a given until now, but at least in beta6 FOR wins cleanly...

Bruce,

The results are meaningless without seeing the test code.

SCAN
IF Condtion
Do something
ENDIF
ENDSCAN

will touch every record in the table, while;

REPLACE ... FOR Condition

with Rushmore will only touch the records that meet the condition.

SCAN FOR Condition

...

ENDSCAN

should be about the same as any other FOR.

WHILE is always faster than FOR because it processes a limited number of records and stops as soon as the condition is not met.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform