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.