Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan / Endscan and processing logic
Message
From
05/07/2006 11:58:58
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01127322
Message ID:
01133870
Views:
19
>>Every line of code we write is interpreted by vfp on the fly. Certain lines of code are the equivalent of calling major c++ functionality - not compiled on the fly.
>>
>>
>>go top
>>do while not eof
>>  if condition
>>    replace field
>>  endif
>>  if not eof()
>>    skip
>>  endif
>>enddo
>>
>>versus
>>
>>
scan for condition
>>    replace field
>>
>>
>>versus
>>
>>
replace something for condition
>>
>>The last should be the fastest because vfp is doing all the work, not your custom code.
>
>I agree with your examples, but which code would you prefer in the following case:
>
>local lcClient, lcCarrier
>select some data into cursor to process order by Client, Carrier
>
>scan
>  lcClent = client
>  lcCarrier = carrier
>  scan while Client == m.lcClient and Carrier = m.lcCarrier
>    * some processing logic
>  endscan
>  skip -1
>  * Create file, do some additional processing
>endscan
>
>versus
>
>lcClient = client
>lcCarrier = carrier
>
>for lnI = 1 to reccount('curProcess') + 1
>   if Client <> m.lcClient or Carrier <> m.lcCarrier or m.lnI = reccount('curProcess') + 1
>    ** Create file, do some additional processing
>   else
>     * do other processing logic
>   endif
>   if not eof()
>     skip
>   endif
>next
>
>Looks like the first should win?

Yes and the first is much more easily understood.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform