Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN vs DO WHILE: Which is faster?
Message
From
15/06/1999 23:13:24
 
 
To
15/06/1999 16:23:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00230167
Message ID:
00230272
Views:
23
>I have been given the task of optimizing the performance of a block of code (too large to be copied here). Currently, the code contains a mix of SCAN..ENDSCAN loops and DO WHILE..ENDDO loops. Some of the WHILE clauses are not Rushmore-optimized, so normally my first step would be to replace these with optimized statements. In some cases, however, this may not be possible.
>
>While I'm at it, I was going to replace the DO WHILE..ENDDO loops with SCAN..ENDSCAN. However, someone mentioned to me that when using non-optimized statements, a DO WHILE..ENDDO can actually give better performance than a SCAN..ENDSCAN. Is this true? I've always used SCAN..ENDSCAN, but some of the legacy code I'm looking at uses DO WHILE..ENDDO.
>
>Bill

Given two constructs:

SCAN
ENDSCAN

vs

DO WHILE !EOF()
SKIP
ENDDO

SCAN will be faster

However, doing FOR/WHILE, your mileage may vary.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform