Lowering high CPU rates?

David Coker davidocoker at gmail.com
Sun Mar 16 13:00:53 EDT 2008


On Sun, Mar 16, 2008 at 10:41 AM, Richard Gaskin
<ambassador at fourthworld.com> wrote:

>  Do you use and progress bars?  If so, I've found them very
>  cycle-consuming, and I tend to update them infrequently now when I'm
>  working with large data sets.
>
>  So instead of doing something like this:
>
>    put 0 into i
>    repeat for each line tLine in tData
>       add 1 to i
>       set the thumbpos of scrollbar "progress" to i
>       ...
>    end repeat
>
>  Now I use the mod operator to reduce the number of times the progress
>  bar is updated:
>
>    put 0 into i
>    repeat for each line tLine in tData
>       add 1 to i
>       if (i mod 100 = 0) then
>         set the thumbpos of scrollbar "progress" to i
>       end if
>       ...
>    end repeat

Hello Richard,
Right now I'm just using a label field that gets updated occasionally,
but was thinking about adding a progress bar for a more professional
appearance. When that happens, your tip above will be invaluable...
thanks for that!

...now to incorporate all of this into the "real" application from my
test stacks and start working on the remaining error handling
routines. Once that's done I can start working on prettying things up
a little more, shuffling the interface elements around making a spot
for goodies like the progress bar.

Looks like I'm almost back to the fun part again.:)

David



More information about the Use-livecode mailing list