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

[REBOL] Re: Help: progress bar to slow

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