Page 1 of 1

pagers for xBrowse

PostPosted: Wed Apr 13, 2016 4:25 pm
by lucasdebeltran
Dear Mr Nages,

It would be very interesting for WAN, ADORDD and SQLRDD to have pagers, so xbrowse does not load all records but just 50 (or the number that fits into the screen), and with pages the user keeps navigating.

Thank you,

Re: pagers for xBrowse

PostPosted: Thu Apr 14, 2016 2:55 pm
by nageswaragunupudi
XBrowse ( or even TWBrowse and TCBrowse ) does that only.

Reads only the number of records required to fill the screen.
When you are on the last line and press down arrow, xbrowse just scrolls the window contents up by a row and reads the next line from data.

When Refresh() is called all rows that fit into the window are read.

That way XBrowse is already optimized.

Slowness is to be attributed solely to the RDD.

Re: pagers for xBrowse

PostPosted: Thu Apr 14, 2016 4:28 pm
by Marcelo Via Giglio
Hello,

but I think there are others issues with xbrowse performance, the sample below show
the times that the data column is reads, you can see the column "4", the optimum should be 5

Code: Select all  Expand view

#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()

   local oDlg, oBrw, aData, n := 0
   
   aData := {{ "one","two","three" },;
             { "one","two","three" },;
             { "one","two","three" },;
             { "one","two","three" },;
             { "one","two","three" }}

   DEFINE DIALOG oDlg SIZE 300, 200

   @ 0, 0 XBROWSE oBrw OF oDlg ;
           HEADER "1","2","3","4";
          COLUMNS 1,2,3,{|| extracol( @n ) };
            ARRAY aData AUTOCOLS
     
   oBrw:CreateFromCode()
   oBrw:bKeyDown = { || oDlg:SetText( Str( oBrw:nColSel ) ) }  
     
   ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize() )

return nil

function extracol( n )
   n++
RETURN n
 



regards

Marcelo Vía

Re: pagers for xBrowse

PostPosted: Wed May 18, 2016 4:05 pm
by Marcelo Via Giglio
Mr. Rao

I see the great enhanced of xbrowse, congratulations, but I don't know if I am wrong about the refresh or repaint issue. I tested a simple xbrowse in a wan enviroment (slow connection with ADS server), and it was really slow. The sample that I posted in this thread show the times what the datas are called and painted

Some comments?

regards

Marcelo Via

Re: pagers for xBrowse

PostPosted: Wed May 18, 2016 6:06 pm
by nageswaragunupudi
Mr Marcelo

but I think there are others issues with xbrowse performance, the sample below show
the times that the data column is reads, you can see the column "4", the optimum should be 5

The question is whether XBrowse does an excessive data access resulting in reduced performance.

Reading the same record any number of times should not affect performance because this is read from cache in memory.

Sameway, skipping records any number of times within the local cache also should not affect performance.

In any case, let us see if xbrowse performs more "skips" than necessary.

We are clear that every refresh() requires (1) skipping to the first row displayed, (2) skipping record by record till the bottom of the browse screen (number of datarows) and (3) skipping back to the original record.

Going up and down by press of key should not result in more than one skip.

Mouse Click causes full refresh.

Keeping this in mind, I provide you here a test program, which shows continuously how many times the Skipper is called.

Code: Select all  Expand view

#include "fivewin.ch"

REQUEST DBFCDX

#ifndef __XHARBOUR__
   #xtranslate DbSkipper => __DbSkipper
#endif

static nSkipperCalls := 0
static oSay


function Main()

   local clog := cFileSetExt( ExeName(), "log" )

   FERASE( clog )
   RDDSETDEFAULT( "DBFCDX" )

   SET DATE ITALIAN
   SET CENTURY ON
   SET DELETED ON

   XbTest()

   if file( clog )
      winexec( "notepad.exe " + clog )
   endif

return nil

function XbTest()

   local oDlg, oBrw, oFont

   USE CUSTOMER NEW SHARED ALIAS CUST VIA "DBFCDX"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont

   @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" AUTOCOLS ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :bSkip      := { |n| ( oBrw:cAlias )->( MySkip( n ) ) }
      //
      :AutoFit()
      :CreateFromCode()
   END

   @ 20,20 SAY oSay PROMPT nSkipperCalls PICTURE "99999" SIZE 100,20 PIXEL OF oDlg UPDATE

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

static function MySkip( n )

   nSkipperCalls++
   oSay:Refresh()

return DbSkipper( n )
 

You can see that xbrowse never calls Skip more than necessary. As long as number of datarows is withing the DBF local cache, even these skips should not affect performance because there is no network access.

Re: pagers for xBrowse

PostPosted: Wed May 18, 2016 6:26 pm
by nageswaragunupudi
Marcelo Via Giglio wrote:Mr. Rao

I see the great enhanced of xbrowse, congratulations, but I don't know if I am wrong about the refresh or repaint issue. I tested a simple xbrowse in a wan enviroment (slow connection with ADS server), and it was really slow. The sample that I posted in this thread show the times what the datas are called and painted

Some comments?

regards

Marcelo Via

Friend,

You are all fortunate to be handling WAN with the latest techonlogies available today. First time I implemented our systems on WAN was about 18 years back. The WAN speeds were only 64 KBPS. Started with Clipper and ADS 5.1 and then moved to 32-bit xharbour. The system included XBrowse of a DBF table with 450,000 records of more than 1KB record length which later grew to more than 650,000 records. Even then, the performance on WAN was good enough. Can not at all compare the speeds with LAN but the performance was quite adequate. Later there were a lot of technological improvements and I left it in 2009.

It is with that experience and confidence that I gave my advice in the earlier posting.

Re: pagers for xBrowse

PostPosted: Thu May 19, 2016 7:21 am
by Maurizio
Hello Nages

I'm using the new features of xbrowse and works very well
This is a my old request , I think it is connected to this topic.

I saw that browse for SQL ( like Mysql-Front) use this process
SELECT * FROM dabase.client LIMIT 100
when I go over the 100 records automatically there is another select
SELECT * FROM dabase.client ORDER LIMIT 100,100;

it would be nice to have this in xBrowse :)

Regards Maurizio
www.nipeservice.com

Re: pagers for xBrowse

PostPosted: Thu May 19, 2016 9:52 am
by nageswaragunupudi
Let us discuss.
What kind of support you like from xbrowse? Can you please elaborate what do you have in mind?

Re: pagers for xBrowse

PostPosted: Thu May 19, 2016 1:02 pm
by Maurizio
Hello ,

When I open a large recodset on WLAN ( mysql on Dreamhost ) I wait 4/5 " to have the data and after I open xBrowse .
example: SELECT * from mydatabase
I know that the delay is in the select and not xBrowse .

If I use :
SELECT * from mydatabase LIMIT 100
and I open xbrowse , I have no delay .

When I browse the data and arrive at the record 100 the command skip() should make another select
SELECT * FROM mydatabase LIMIT 100,100
and refreh the browse.

Regards Maurizio

Re: pagers for xBrowse

PostPosted: Thu May 19, 2016 1:51 pm
by nageswaragunupudi
I am thinking ...

Meanwhile please share your thoughts too. How do you propose to handle GoBottom(), GoTop(), skip( n ) and skip( -n ), Seek, Sort, etc.

Welcome any ideas from any one interested in the topic.

Also, if you do not mind my asking, may I know the FWH version you are using now?

Re: pagers for xBrowse

PostPosted: Thu May 19, 2016 2:17 pm
by Maurizio
I use April 2016

Gets in Header with SQL

Image

Regards Maurizio

Re: pagers for xBrowse

PostPosted: Thu May 19, 2016 4:21 pm
by nageswaragunupudi
This may involve multiple Recordsets, opening on demand and swapping them on the basis of navigational needs. Unfortunately there is no way to append or concatenate recordsets. This adds quite a bit complexity to coding but can be done if it is really worthwhile.

What we may lose in the process are sort, seek, filters. Do you think the trade off is worthwhile for saving 3/4 seconds initially? I am asking your opinion.

I am considering another approach too.

Re: pagers for xBrowse

PostPosted: Thu May 19, 2016 8:25 pm
by Marcelo Via Giglio
Thanks Mr. Rao for the explanation

Re: pagers for xBrowse

PostPosted: Mon Feb 06, 2017 12:48 am
by nageswaragunupudi
Maurizio wrote:Hello ,

When I open a large recodset on WLAN ( mysql on Dreamhost ) I wait 4/5 " to have the data and after I open xBrowse .
example: SELECT * from mydatabase
I know that the delay is in the select and not xBrowse .

If I use :
SELECT * from mydatabase LIMIT 100
and I open xbrowse , I have no delay .

When I browse the data and arrive at the record 100 the command skip() should make another select
SELECT * FROM mydatabase LIMIT 100,100
and refreh the browse.

Regards Maurizio

Hope you are aware that this is possible now with FWH MySql library.
In fact your above proposal resulted in this library.

Re: pagers for xBrowse

PostPosted: Mon Feb 06, 2017 8:05 am
by Maurizio
Thanks Mr. Rao

Maurizio
www.nipeservice.com