Xbase++/Express++ Performance Issues

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Xbase++/Express++ Performance Issues

#1 Post by unixkd »

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++

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: Xbase++/Express++ Performance Issues

#2 Post by bwolfsohn »

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
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

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Xbase++/Express++ Performance Issues

#3 Post by rdonnay »

The slowest thing windows does is write to the screen.
You should follow Brian's advice.
The eXpress train is coming - and it has more cars.

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: Xbase++/Express++ Performance Issues

#4 Post by reganc »

bwolfsohn 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
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

Post Reply