very slow sample program xbrbckg1.prg

very slow sample program xbrbckg1.prg

Postby MarcoBoschi » Wed Apr 01, 2020 5:37 pm

Hi everybody
I've tried it it's very very slow I don't understand why. Could someone else test it please?
It seems that at every key pressed it performs a lot of things.
I know very little xbrowse class so I ask it in the group

Many thanks
to all
marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: very slow sample program xbrbckg1.prg

Postby Euclides » Wed Apr 01, 2020 8:15 pm

Ciao Marco...
Use this image: https://imagizer.imageshack.com/img923/276/DFYUs0.jpg
Is a quite faster... olga1.jpg is resized and is slow
regards, Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Re: very slow sample program xbrbckg1.prg

Postby nageswaragunupudi » Wed Apr 01, 2020 8:32 pm

Having a background image slows down.
Every cell movement results in full refresh of the browse.
This is suitable for small browses and data that is already in memory.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10633
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: very slow sample program xbrbckg1.prg

Postby MarcoBoschi » Thu Apr 02, 2020 8:44 am

Hi,
I took away what seems superfluous to me.
- RIGHT very slow
- LEFT slow
- UP and DOWN normal but I see flicker across the entire line
- PG UP and PG DOWN not fast but not really bad

take it as a report not as a criticism thanks

Have a nice day

Marco


Code: Select all  Expand view

#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'

REQUEST DBFCDX

function Main()

   local oWnd,  oBrw

   USE CUSTOMER SHARED

   DEFINE WINDOW oWnd TITLE 'XBrowse without BackGrounds'

   @ 0, 0 XBROWSE oBrw OF oWnd ;
      ALIAS 'CUSTOMER' AUTOCOLS ;
      CELL LINES ;
      COLOR CLR_BLUE, CLR_WHITE


   SET MESSAGE OF oWnd TO FWVERSION 2007

   oBrw:CreateFromCode()
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd MAXIMIZED


return nil
 
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: very slow sample program xbrbckg1.prg

Postby MarcoBoschi » Fri Apr 03, 2020 1:36 pm

In method METHOD Paint() CLASS TXBrowse

if I rem DispBegin() and DispEnd()

// local aInfo := ::DispBegin()
and at the end of method I rem

if ::nLen == 0
::EraseData( nFirstRow )
// ::DispEnd( aInfo )
return nil
endif


// ::DispEnd( aInfo )

the problem is even more evident

I use also a dbf of 400 fields and 100 records

I've noticed this method is evocated every time I press VK_RIGHT instead for other key pressed no only in particular conditions
The question is: Is it possible to insert some conditions in the method to make the paint run only when needed?
Have a nice day
Marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: very slow sample program xbrbckg1.prg

Postby nageswaragunupudi » Wed Sep 09, 2020 8:43 am

Commenting out DispBegin() and DispEnd() is not the right thing to do.

Please also see
viewtopic.php?f=20&t=38740

WBrowse is the fastest browse. XBrowse is not created to provide a faster alternative, but a feature-rich browse. Still with oBrw:lFastDraw set to .t., speeds are closer to wbrowse though not faster.

It is worth testing xbrowse's performance with a very large table. In this following sample, we create a DBF with One Million Records, 81 fields and recordsize of 1061 bytes and try to browse it.

Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   field FIRST,LAST,STREET,CITY,STATE,ZIP,HIREDATE,MARRIED,AGE,SALARY
   field FIRST2,LAST2,STREET2,CITY2,STATE2,ZIP2,HIREDATE2,MARRIED2,AGE2,SALARY2
   field FIRST3,LAST3,STREET3,CITY3,STATE3,ZIP3,HIREDATE3,MARRIED3,AGE3,SALARY3
   field FIRST4,LAST4,STREET4,CITY4,STATE4,ZIP4,HIREDATE4,MARRIED4,AGE4,SALARY4
   field FIRST5,LAST5,STREET5,CITY5,STATE5,ZIP5,HIREDATE5,MARRIED5,AGE5,SALARY5
   field FIRST6,LAST6,STREET6,CITY6,STATE6,ZIP6,HIREDATE6,MARRIED6,AGE6,SALARY6
   field FIRST7,LAST7,STREET7,CITY7,STATE7,ZIP7,HIREDATE7,MARRIED7,AGE7,SALARY7
   field FIRST8,LAST8,STREET8,CITY8,STATE8,ZIP8,HIREDATE8,MARRIED8,AGE8,SALARY8

   local aStruct, cCust, cmiln, n, nLen, a, i, c

   cCust    := "c:\fwh\samples\customer.dbf"
   cmiln    := "c:\fwh\samples\custmiln.dbf"

   if File( cmiln )
      USE ( cmiln ) NEW ALIAS "CUST" VIA "DBFCDX"
   else
      aStruct  := FW_DBFSTRUCT( cCust )
      ASize( aStruct, Len( aStruct ) - 1 )
      nLen     := Len( aStruct )
      for i := 2 to 8
         c  := Str( i, 1, 0 )
         for n := 2 to nLen
            a  := AClone( aStruct[ n ] )
            a[ 1 ]   += c
            AAdd( aStruct, a )
         next
      next

      XBROWSER aStruct SHOW SLNUM

      DBCREATE( cmiln, aStruct, "DBFCDX", .t., "CUST" )

      for n := 1 to 2000
         APPEND FROM c:\fwh\samples\customer.dbf ;
         FIELDS FIRST,LAST,STREET,CITY,STATE,ZIP,HIREDATE,MARRIED,AGE,SALARY
      next
      GO TOP
      REPLACE ALL FIRST2 WITH FIRST, LAST2 WITH LAST, CITY2 WITH CITY, STATE2 WITH STATE, ;
                  ZIP2 WITH ZIP, HIREDATE2 WITH HIREDATE, MARRIED2 WITH MARRIED, ;
                  AGE2 WITH AGE, SALARY2 WITH SALARY
      REPLACE ALL FIRST3 WITH FIRST, LAST3 WITH LAST, CITY3 WITH CITY, STATE3 WITH STATE, ;
                  ZIP3 WITH ZIP, HIREDATE3 WITH HIREDATE, MARRIED3 WITH MARRIED, ;
                  AGE3 WITH AGE, SALARY3 WITH SALARY
      REPLACE ALL FIRST4 WITH FIRST, LAST4 WITH LAST, CITY4 WITH CITY, STATE4 WITH STATE, ;
                  ZIP4 WITH ZIP, HIREDATE4 WITH HIREDATE, MARRIED4 WITH MARRIED, ;
                  AGE4 WITH AGE, SALARY4 WITH SALARY
      REPLACE ALL FIRST5 WITH FIRST, LAST5 WITH LAST, CITY5 WITH CITY, STATE5 WITH STATE, ;
                  ZIP5 WITH ZIP, HIREDATE5 WITH HIREDATE, MARRIED5 WITH MARRIED, ;
                  AGE5 WITH AGE, SALARY5 WITH SALARY
      REPLACE ALL FIRST6 WITH FIRST, LAST6 WITH LAST, CITY6 WITH CITY, STATE6 WITH STATE, ;
                  ZIP6 WITH ZIP, HIREDATE6 WITH HIREDATE, MARRIED6 WITH MARRIED, ;
                  AGE6 WITH AGE, SALARY6 WITH SALARY
      REPLACE ALL FIRST7 WITH FIRST, LAST7 WITH LAST, CITY7 WITH CITY, STATE7 WITH STATE, ;
                  ZIP7 WITH ZIP, HIREDATE7 WITH HIREDATE, MARRIED7 WITH MARRIED, ;
                  AGE7 WITH AGE, SALARY7 WITH SALARY
      REPLACE ALL FIRST8 WITH FIRST, LAST8 WITH LAST, CITY8 WITH CITY, STATE8 WITH STATE, ;
                  ZIP8 WITH ZIP, HIREDATE8 WITH HIREDATE, MARRIED8 WITH MARRIED, ;
                  AGE8 WITH AGE, SALARY8 WITH SALARY

      GO TOP
      FW_CdxCreate( "ID,FIRST,LAST,STREET,CITY,STATE,ZIP,HIREDATE,MARRIED,AGE,SALARY" )
      GO TOP
   endif

   XBROWSER ALIAS() TITLE "One Million Records: 81 Fields: Record Len: 1061" ;
   SETUP ( oBrw:aCols[ 1 ]:cEditPicture := "99,999,999", oBrw:lFastDraw := .t., ;
           oBrw:lVThumbTrack := .t., oBrw:lAutosort := .t. )

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10633
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: very slow sample program xbrbckg1.prg

Postby nageswaragunupudi » Wed Sep 09, 2020 9:49 am

Next, we will create a 100 record table with 400 fields and see the horizontal scrolling performance.
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local cDbf     := "c:\fwh\samples\customer.dbf"
   local cNew     := "c:\fwh\samples\cust400f.dbf"
   local i,j,n,c,aCol, aData, aRow, aCols, aNew := {}

   if File( cNew )
      USE ( cNew ) NEW ALIAS C400 VIA "DBFCDX"
      ? "Open"
   else
      USE ( cDbf )
      aCols    := DBSTRUCT( cDbf )
      AAdd( aNew, aCols[ 1 ] )

      for i := 1 to 40
         c  := StrZero( i, 2, 0 )
         for n := 2 to 11
            aCol  := AClone( aCols[ n ] )
            aCol[ 1 ] += c
            AAdd( aNew, aCol )
         next
      next

      aData := FW_DbfToArray( nil, nil, { || RECNO() <= 100 } )
      CLOSE DATA

      DBCREATE( cNew, aNew, "DBFCDX", .T., "C400" )
      for each aRow in aData
         DBAPPEND()
         n  := 2
         for i := 1 to 40
            for j := 2 to 11
               FieldPut( n, aRow[ j ] )
               n++
            next
         next
      next
      GO TOP
   endif

   XBROWSER ALIAS() SETUP ( oBrw:nMarqueeStyle := 3, oBrw:lFastDraw := .t. )

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10633
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: very slow sample program xbrbckg1.prg

Postby Otto » Wed Sep 09, 2020 9:55 am

Dear Mr. Rao,
Thank you for your sample.
Please show us how we can implement a column search; I mean that I enter a column name and browser repositions vertically.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: very slow sample program xbrbckg1.prg

Postby nageswaragunupudi » Wed Sep 09, 2020 10:26 am

Code: Select all  Expand view
oBrw:GoToCol( <column_name> )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10633
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: very slow sample program xbrbckg1.prg

Postby MarcoBoschi » Wed Sep 09, 2020 2:01 pm

Thank You Mr Rao
8)
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: very slow sample program xbrbckg1.prg

Postby Enrico Maria Giordano » Wed Sep 09, 2020 3:04 pm

Ok, but this sample is still slow:


Code: Select all  Expand view
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'

REQUEST DBFCDX

function Main()

   local oWnd,  oBrw

   USE CUSTOMER SHARED

   DEFINE WINDOW oWnd TITLE 'XBrowse without BackGrounds'

   @ 0, 0 XBROWSE oBrw OF oWnd ;
      ALIAS 'CUSTOMER' AUTOCOLS ;
      CELL LINES ;
      COLOR CLR_BLUE, CLR_WHITE


   SET MESSAGE OF oWnd TO FWVERSION 2007

   oBrw:CreateFromCode()
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd MAXIMIZED


return nil


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: very slow sample program xbrbckg1.prg

Postby Enrico Maria Giordano » Wed Sep 09, 2020 3:09 pm

Ok, with lFastDraw set to .T. even that sample become fast. What is the advantage of setting lFastDraw to .F.?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Re: very slow sample program xbrbckg1.prg

Postby nageswaragunupudi » Sun Sep 27, 2020 8:32 am

Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10633
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: very slow sample program xbrbckg1.prg

Postby Enrico Maria Giordano » Sun Sep 27, 2020 9:29 am

The question was: what is the advantage of setting lFastDraw to .F.? And the answer is? :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 35 guests