Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan / Endscan and processing logic
Message
De
05/07/2006 11:58:58
Mike Yearwood
Toronto, Ontario, Canada
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01127322
Message ID:
01133870
Vues:
20
>>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform