The extent to which the progress bar slows down the process

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

The extent to which the progress bar slows down the process

#1 Post by Eugene Lutsenko »

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

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

Re: The extent to which the progress bar slows down the proc

#2 Post by rdonnay »

Yes, it will slow down the process because writing to the screen is slow.

This is why you should use the EVERY clause.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: The extent to which the progress bar slows down the proc

#3 Post by Auge_Ohr »

Eugene Lutsenko wrote:I had the impression that the progress bar DC_GetProgress() is much stronger slows down the process than waiting DC_WaitOn()
how do you use it ?
DC_WaitOn() is using a Thread.
greetings by OHR
Jimmy

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

#4 Post by Eugene Lutsenko »

It turns out that special is no difference

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 )
[/size]
Attachments
Downloads.zip
(48.56 KiB) Downloaded 699 times

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: The extent to which the progress bar slows down the proc

#5 Post by Auge_Ohr »

Eugene Lutsenko wrote:It turns out that special is no difference

Code: Select all

   mN = 1000
   ...
   @ 4,5 DCPROGRESS oProgress SIZE 70,1.1 MAXCOUNT nMax COLOR GRA_CLR_CYAN PERCENT EVERY 100
with mN := 1000 and EVERY 100 you got 10 Steps ...
use much bigger Number like nM := 1000000 to get Time Difference
greetings by OHR
Jimmy

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

#6 Post by Eugene Lutsenko »

Auge_Ohr wrote:
Eugene Lutsenko wrote:It turns out that special is no difference

Code: Select all

   mN = 1000
   ...
   @ 4,5 DCPROGRESS oProgress SIZE 70,1.1 MAXCOUNT nMax COLOR GRA_CLR_CYAN PERCENT EVERY 100
with mN := 1000 and EVERY 100 you got 10 Steps ...
use much bigger Number like nM := 1000000 to get Time Difference
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.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: The extent to which the progress bar slows down the proc

#7 Post by Auge_Ohr »

Eugene Lutsenko wrote:I understand and noticed, it was tested on much larger quantities, such as 10,000.
much more while 10,000/100 = 100 step to "paint" is just a blink
Eugene 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.
your Demo still have "fix" EVERY 100 so it only make 1000/100 = 10 Step

with 1000000 it make a lot of (unneed) step ... you only need

Code: Select all

   nEvery := nMax / 100
   ... EVERY nEvery
about compare with DC_WaitOn()

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
so DC_WaitOn() can differ in -+20 -> 40ms
greetings by OHR
Jimmy

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

#8 Post by Cliff Wiernik »

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.

Post Reply