>><snip>
>>
>>Hi Fabio. Any idea why there would be this difference in speed between these methods?
>>
>>Ciao!
>
>Of course, only hypothesis:
>- LOCATE it demands of the additional operations
>because VFP have to store the expression and status
>for execute a eventual successive
CONTINUE operation;
>- SCAN it does not have to make this job additional;
>honestly this explanation me seems insufficient to explain all,
> SCAN has an overload which had to the control of endscan.
>
>- LOOKUP it is the true force of VFP, the inner code of search,
>it is effectively 2x faster than LOCATE;
>an explanation part is in the fact that LOCATE/SCAN must revalue
>all the expression for every record, LOOKUP use a C data driver code (?)
>( get the parm2 and compare with the field=parm3 )
>
>An other small improvement can be obtained adding NOOPTIMIZE
>(if it is sure that VFP cannot optimize the FOR),
>in this case VFP jumps all the phase of analysis for the optimization.
>If it is present WHILE, NOOPTIMIZE it is not required,
>because with WHILE VFP it cannot optimize the FOR.
>
>Ciao
>
>Fabio
Hi Fabio - thanks for the info. Most interesting and something to experiment with.
Thanks and ciao!
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.