Simple fix:

Move the mod() function into a 'ShowProgress(CountNow,TotalCount)' 
function.  If we aren't at a percentile point just return.  If we are, 
then update whatever kind of display you are using.  Don't muck up your 
work code trying to tune the progress display; leave that to the 
function.  MUCH easier to debug.

The problem is not the mod() execution, it's displaying the result that 
takes time.  Don't guess, measure!

Dan Covill

On 12/05/11 14:54, Charlie Coleman wrote:
> At 04:49 PM 12/5/2011 -0500, MB Software Solutions,     LLC wrote:
>> On 12/5/2011 8:47 AM, Gérard Lochon wrote:
>>>> That will show you a WAIT WINDOW every 100 rows processed.
> ...
>   >  m.todo = " of "+TRANSFORM(RECCOUNT())+" ..."
>>> m.odom =  100
>>> GO TOP
>>>
>>> SCAN REST
>>>       SCAN NEXT m.odom
> ...
>>>       WAIT WINDOW NOWAIT TRANSFORM(RECNO())+m.todo
>>> ENDSCAN
> ...
>> Wonder how much more efficiency that really gets you?
>
> Obviously it is saving the MOD() function execution that would have
> otherwise hit on every record. VFP is pretty darn fast for an interpreted
> language, but dropping 1 line of code could be significant in tight loops.
> We're probably talking maybe around .5 microseconds (based on machine speed
> of course). So that'd be about .5 seconds every 1,000,000 records.
>
> But that's raw numbers. The thing is, if your code inside the loop takes
> about 2 microseconds to process, the routine would appear to run 25%
> faster. If the code took 5 microseconds to run, the routine would appear to
> only get a 10% speed boost.
>
> I'm definitely tucking away this technique. I've got a couple cases where
> I'm messing with multi-millions of rows. I'll try it both ways and see how
> significant the difference is.
>
> -Charlie

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to