FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MsgMeter too slow ... (solved)
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM

MsgMeter too slow ... (solved)

Posted: Thu Mar 05, 2015 05:28 AM
Guys:

Dealing with a large database (4.7 million records), the MsgMeter is too slow compared to the same index creation without a meter.
I DO want to show some sort of progress during index creation, how can I do it without such a performance penalty ? Thank you very much.
Code (fw): Select all Collapse
   MsgMeter( { | oMeter, oText, oDlg, lEnd | ;
             BuildIndex( oMeter, oText, oDlg, @lEnd ) },;
             "Building the Index..." )

   USE

return nil

//----------------------------------------------------------------------------//

function BuildIndex( oMeter, oText, oDlg, lEnd )
   FIELD Last

   oMeter:nTotal = RecCount()

   INDEX ON Last TO CustLast ;
      EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: MsgMeter too slow ...

Posted: Thu Mar 05, 2015 09:09 AM

Use EVERY clause of INDEX ON command to update the meter less frequently (ie. not for each record).

EMG

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: MsgMeter too slow ...

Posted: Thu Mar 05, 2015 09:33 AM
Enrico
YES, using EVERY => a sample with 100 record steps :

Code (fw): Select all Collapse
#include "Fivewin.ch"

FUNCTION MAIN()

SET _3DLOOK ON

USE Customer

MsgMeter( { | oMeter, oText, oDlg, lEnd | ;
BuildIndex( oMeter, oText, oDlg, @lEnd, 100 ) },; // step 100 records
"Building the Index..." )

USE

RETURN NIL

//------------------------------------- 

FUNCTION BUILDINDEX( oMeter, oText, oDlg, lEnd, nStep )
 
FIELD Last 

oMeter:nTotal = RecCount()

INDEX ON Last TO CustLast EVERY nStep ;
EVAL ( oMeter:Set( RecNo() ), SysRefresh(), ! lEnd )

RETURN NIL


best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM

Re: MsgMeter too slow ... (solved)

Posted: Thu Mar 05, 2015 05:26 PM
Uwe, Erico:

Thank you very much for the tip ! Worked flawlessly !

To program this for any size DBF I calculated the step as follows:
Code (fw): Select all Collapse
nStep := INT ( RECCOUNT() / 25 )
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM

Re: MsgMeter too slow ... (solved)

Posted: Fri Mar 06, 2015 12:22 AM
HunterEC wrote:Uwe, Erico:

Thank you very much for the tip ! Worked flawlessly !

To program this for any size DBF I calculated the step as follows:
Code (fw): Select all Collapse
nStep := INT ( RECCOUNT() / 25 )


Code (fw): Select all Collapse
If RecCount() < 100
   nStep := 1 
End
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM

Re: MsgMeter too slow ... (solved)

Posted: Fri Mar 06, 2015 05:14 AM

Samir (sambomb):

Obrigado / Thank you.

Continue the discussion