Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Help: progress bar to slow

 [1/5] from: reboler::programmer::net at: 20-Nov-2002 11:27


I have a progress bar that keeps track of the progress of an encryption/decryption process. My problem is that updating it is extremely slow. A decryption that takes about 4 seconds without the progress bar takes 10 seconds with the progress bar. I update the bar with the following function: update-progress: func [ progress-face current-index max-index ][ wait 0 if current-index // 50 = 0 [ progress-face/data: current-index / max-index show progress-face ] ] The "if current-index ..." part was included to try and speed it up, but even calling "show" 50-times less frequently doesn't help much. The progress bar itself is as follows: display-encrypt-mode: progress "En/Decrypt Mode" 150x20 center bold 172.158.140 font-color black font [size: 12 shadow: none] with [saved-area: true] Anyone have any ideas on why this is so slow?

 [2/5] from: gscottjones:mchsi at: 20-Nov-2002 11:29


From: "alan parman"
> I have a progress bar that keeps track of the progress of an
encryption/decryption process.
> My problem is that updating it is extremely slow. > A decryption that takes about 4 seconds without the progress bar takes 10
seconds with the progress bar.
> I update the bar with the following function: > update-progress: func [
<<quoted lines omitted: 9>>
> ] > The "if current-index ..." part was included to try and speed it up, but
even calling "show" 50-times less frequently doesn't help much.
> The progress bar itself is as follows: > > display-encrypt-mode: progress "En/Decrypt Mode" 150x20 center bold
172.158.140 font-color black font [size: 12 shadow: none] with [saved-area: true]
> Anyone have any ideas on why this is so slow?
Hi, Alan, I am unsure why you may have called wait. What surprises me is that it makes a big difference (about a factor of two). I expanded your code sample into the following in order to illustrate. ;#######expanded code########## update-progress: func [ progress-face current-index max-index /w ][ if w [wait 0] if current-index // 50 = 0 [ progress-face/data: current-index / max-index show progress-face ] ] view layout [ display-encrypt-mode: progress "En/Decrypt Mode" 150x20 center bold 172.158.140 font-color black font [size: 12 shadow: none] with [saved-area: true] button "Start" [ repeat c 100000 [ update-progress display-encrypt-mode c 100000 ] ] button "Start&Wait" [ repeat c 100000 [ update-progress/w display-encrypt-mode c 100000 ] ] ] ;#######end code########## Is the "wait 0" call there for another reason? --Scott Jones

 [3/5] from: gchiu:compkarori at: 21-Nov-2002 7:58


On Wed, 20 Nov 2002 11:29:20 -0600 "G. Scott Jones" <[gscottjones--mchsi--com]> wrote:
>Is the "wait 0" call there for another reason? >--Scott Jones
Hi Scott, I sometimes put wait 0 in my loops to allow other events to be processed ...like a 'cancel' button event -- Graham Chiu

 [4/5] from: nitsch-lists:netcologne at: 21-Nov-2002 0:43


On Wed, Nov 20, 2002 at 11:27:27AM -0500, alan parman wrote:
> I have a progress bar that keeps track of the progress of an encryption/decryption process. > My problem is that updating it is extremely slow.
<<quoted lines omitted: 12>>
> ] > The "if current-index ..." part was included to try and speed it up, but even calling "show" 50-times less frequently doesn't help much.
why base show-check on current index instead of based on progress-face/data ? something like d2: current-index / max-index if d2 - 0.1 > progress-face/data[ .. ] would reduce to 10 show in 10% - increments. also the frequency fits display-increment better.
> The progress bar itself is as follows: > > display-encrypt-mode: progress "En/Decrypt Mode" 150x20 center bold 172.158.140 font-color black font [size: 12 shadow: none] with [saved-area: true] > > Anyone have any ideas on why this is so slow? > --
-volker

 [5/5] from: reboler:programmer at: 21-Nov-2002 14:20


Re: Help: progress bar to slow I don't absolutely need the 'wait. I included it for the same reason Graham does: so that future modifications of the code would allow me to stop the encryption process mid stream, since it can sometimes take a very long time with large files. I did remove it from my script but it didn't improve the time by much. I believe the time is being added with the 'show, because when I reduce the number of times show is called, the script speeds up. It still is about 2 times longer with the progress bar active than without it. I will try Volkers suggestion today. It seems like a good way to restrict the number of 'show calls no matter what the size of the file is.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted