Lowering high CPU rates?

David Coker davidocoker at gmail.com
Sun Mar 16 08:54:04 EDT 2008


>  Once you know where the hold up is, you can work on optimizing it
>  first.  No sense in sticking your finger in a hole that isn't leaking.
>
>  len morgan

Heh, that's great! :)

Actually though, with all of the testing I've done I'm fairly sure
about the "where's and what's" that are causing the problem. For
example with a source file containing 30,000 lines or greater:

Removing lines with zeros and/or blank fields.  -->Huge drain 100%
Sorting the lines according to the requirements -->Huge drain 100%

The problem is less about knowing why, but rather trying to find a
user friendlier approach to dealing with it. For example, during the
final stage of processing that is visible to the user (and the most
time consuming), I've added a button that will pause and/or resume
according to the needs of the user, which works great. That approach
doesn't work well with the preprocessing that must be done and locking
the screen to help speed things up only adds to what would be a
potentially negative user experience. The infamous catch 22, I think.

Digging through the doc's, I ran across these little gems that may
prove to be helpful:

idleRate
Adjust the idleRate property to change the interval between
periodically-sent messages. Increasing the idleRate causes these
messages to be sent less frequently, and decreases the amount of CPU
time the application uses.

idleTicks
Adjust the idleTicks property to change the interval between
periodically-sent messages. Increasing the idleTicks causes these
messages to be sent less frequently, and decreases the amount of CPU
time the application uses.

I can make the program follow different methods based on the number of
lines in the target file easy enough and perhaps issue a warning about
the processing requirements.

Does anyone know of a way to gather specific system details such as
available RAM and/or CPU speed? When combined with total line count,
that would give me the ability to code in a best course of action,
based on the system resources available. ;)

David



More information about the use-livecode mailing list