The extent to which the progress bar slows down the process?
I had the impression that the progress bar DC_GetProgress() is much stronger slows down the process than waiting DC_WaitOn()
The extent to which the progress bar slows down the process
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: The extent to which the progress bar slows down the proc
Yes, it will slow down the process because writing to the screen is slow.
This is why you should use the EVERY clause.
This is why you should use the EVERY clause.
The eXpress train is coming - and it has more cars.
Re: The extent to which the progress bar slows down the proc
how do you use it ?Eugene Lutsenko wrote:I had the impression that the progress bar DC_GetProgress() is much stronger slows down the process than waiting DC_WaitOn()
DC_WaitOn() is using a Thread.
greetings by OHR
Jimmy
Jimmy
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: The extent to which the progress bar slows down the proc
It turns out that special is no difference
[/size]
Code: Select all
***********************************************************************************************************************
mN = 1000
@1+0.2,12 DCSAY "Задайте значение N:"
@2 ,27 DCSAY "" GET mN PICTURE "#######"
DCGETOPTIONS TABSTOP
DCREAD GUI ;
FIT ;
OPTIONS GetOptions ;
ADDBUTTONS;
MODAL ;
TITLE '(C) Луценко Е.В. Измерение времени исполнения'
***********************************************************************************************************************
aMess := {}
nSeconds1 := Seconds()
nMax = mN
Mess = 'Цикл от 1 до N='+ALLTRIM(STR(mN))
@ 4,5 DCPROGRESS oProgress SIZE 70,1.1 MAXCOUNT nMax COLOR GRA_CLR_CYAN PERCENT EVERY 100
DCREAD GUI TITLE Mess PARENT @oDialog FIT EXIT
oDialog:show()
nTime = 0
DC_GetProgress(oProgress,0,nMax)
FOR j = 1 TO mN
s = 0
FOR i=1 TO j
s = s + i
NEXT
DC_GetProgress(oProgress, ++nTime, nMax)
NEXT
DC_GetProgress(oProgress,nMax,nMax)
oDialog:Destroy()
AADD(aMess, 'На расчет c DC_GetProgress затрачено: '+Alltrim(Str(Seconds()-nSeconds1,15,7)) + ' секунд')
**************************************************
nSeconds2 := Seconds()
oScrn := DC_WaitOn('Немного подождите')
FOR j = 1 TO mN
s = 0
FOR i=1 TO j
s = s + i
NEXT
NEXT
DC_Impl(oScrn)
AADD(aMess, 'На расчет с DC_WaitOn затрачено: '+Alltrim(Str(Seconds()-nSeconds2,15,7)) + ' секунд')
LB_Warning( aMess )
- Attachments
-
- Downloads.zip
- (48.56 KiB) Downloaded 700 times
Re: The extent to which the progress bar slows down the proc
with mN := 1000 and EVERY 100 you got 10 Steps ...Eugene Lutsenko wrote:It turns out that special is no differenceCode: Select all
mN = 1000 ... @ 4,5 DCPROGRESS oProgress SIZE 70,1.1 MAXCOUNT nMax COLOR GRA_CLR_CYAN PERCENT EVERY 100
use much bigger Number like nM := 1000000 to get Time Difference
greetings by OHR
Jimmy
Jimmy
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: The extent to which the progress bar slows down the proc
I understand and noticed, it was tested on much larger quantities, such as 10,000. The program is attached there. You can try. But it turns out there is a noticeable difference, and the unexpected in small quantities. And at large there is practically no difference.Auge_Ohr wrote:with mN := 1000 and EVERY 100 you got 10 Steps ...Eugene Lutsenko wrote:It turns out that special is no differenceCode: Select all
mN = 1000 ... @ 4,5 DCPROGRESS oProgress SIZE 70,1.1 MAXCOUNT nMax COLOR GRA_CLR_CYAN PERCENT EVERY 100
use much bigger Number like nM := 1000000 to get Time Difference
Re: The extent to which the progress bar slows down the proc
much more while 10,000/100 = 100 step to "paint" is just a blinkEugene Lutsenko wrote:I understand and noticed, it was tested on much larger quantities, such as 10,000.
your Demo still have "fix" EVERY 100 so it only make 1000/100 = 10 StepEugene Lutsenko wrote:The program is attached there. You can try. But it turns out there is a noticeable difference, and the unexpected in small quantities. And at large there is practically no difference.
with 1000000 it make a lot of (unneed) step ... you only need
Code: Select all
nEvery := nMax / 100
... EVERY nEvery
as it use a Thread, which you have to Stop with DC_Impl(), you calculation is the same as above
with small Number you have to know what Thread is doing
Code: Select all
FUNCTION dc_waiton (
...
oThread:Start({||_Working(@oDlg)})
STATIC FUNCTION _Working( oDlg )
...
DO WHILE Valtype(oDlg) = 'O' .AND. oDlg:cargo[2] .AND. oDlg:status() > 0
...
Sleep(20) // <- fix
greetings by OHR
Jimmy
Jimmy
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: The extent to which the progress bar slows down the proc
I usually compute my nEvery so it only updates when the percentage completion changes by 1 or 5. So for 200000 records, every 200000/100 = 2000 records or for every 5%, 200000/20= 10000 records.