Out of curousity, I was testing the time taken for some routines in our applications for performance. Here are my initial findings:
Function PerfomanceTest()
LOCAL x[3], nCount := 1, nRecs := 100000000
Local oProg := ProgressBar():New()
oProg:nMaxCount := nRecs
x[1] := Seconds()
Do While nCount <= nRecs
nCount++
Enddo
x[1] := Seconds() - x[1]
oProg:ProgressBar(0)
x[2] := Seconds()
Do While oProg:nRecCounter <= nRecs
oProg:ProgressBar(1,oProg:nRecCounter++)
Enddo
x[2] := Seconds() - x[2]
oProg:ProgressBar(2)
x[3] := Seconds()
For I := 1 To nRecs
nCount++
Next
x[3] := Seconds() - x[3]
DC_Arrayview( x )
Return nil
Result: x[1] ---> 0.98 seconds
x[2] ----> 4437.77 seconds (1 hour, 24 minutes)
x[3] ----> 29.73 seconds
Inference: 1. Do while ... enddo is faster than For ... Next contruct
2. Progress Bar Class/Function slows down Database Processes in a very serious magnitude.
I need a Progress bar coded in Assembly Language or Compiler that uses registered based parameter passing like PowerBasic or Defunct TopSpeed C++
Xbase++/Express++ Performance Issues
Re: Xbase++/Express++ Performance Issues
You might want to try this to cut down your elapsed time by an order of magnitude..
no need to refresh the progress bar on each record..
nEvery:=int(reccount()/100) // or divide by 20 and it will display ctr every 5%
go top
nCtr:=0
do while !eof()
if nCtr % nEvery ==0
do your progressbar thing
endif
dbskip()
nCtr++
enddo
Brian
no need to refresh the progress bar on each record..
nEvery:=int(reccount()/100) // or divide by 20 and it will display ctr every 5%
go top
nCtr:=0
do while !eof()
if nCtr % nEvery ==0
do your progressbar thing
endif
dbskip()
nCtr++
enddo
Brian
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Re: Xbase++/Express++ Performance Issues
The slowest thing windows does is write to the screen.
You should follow Brian's advice.
You should follow Brian's advice.
The eXpress train is coming - and it has more cars.
Re: Xbase++/Express++ Performance Issues
Brianbwolfsohn wrote:You might want to try this to cut down your elapsed time by an order of magnitude..
no need to refresh the progress bar on each record..
nEvery:=int(reccount()/100) // or divide by 20 and it will display ctr every 5%
go top
nCtr:=0
do while !eof()
if nCtr % nEvery ==0
do your progressbar thing
endif
dbskip()
nCtr++
enddo
Brian
I agree with the idea but I would suggest using the seconds() function like so instead:
Code: Select all
go top
nSeconds:=0
do while !eof()
if seconds()-nSeconds > 0.5
do your progressbar thing
nSeconds:=seconds()
endif
dbskip()
enddo
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com