Is there a faster way...
Ken Ray
kray at sonsothunder.com
Fri May 3 12:28:00 EDT 2002
Bill,
Two quick "speed-up" suggestions:
(1) Use "repeat for each" instead for "repeat with" - it is a lot faster, if
you make Rev increment a counter:
put 0 into tCounter
repeat for each line tLine in field "Directory"
add 1 to tCounter
if (item 1 of tLine) & " " & (item 2 of tLine) <> vName then
(etc.)
(2) Don't put the progress into a field (or if you do, don't do it for each
loop - do it every 10 or 100 loops) - this slows things down quite a bit. To
do things every 100 loops, you can use the 'mod' function:
if (tCounter mod 100) = 0 then put tCounter into field "Records"
Hope this helps,
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
----- Original Message -----
From: "Bill Vlahos" <bvlahos at jpl.nasa.gov>
To: <use-revolution at lists.runrev.com>
Sent: Friday, May 03, 2002 11:03 AM
Subject: Is there a faster way...
> I want to analyze a text log file. The following script works but takes
> a long time (45 seconds to go through 2500 lines).
>
> The first 2 items in the TAB delimited field are "Group" then "Task".
> All I really want to do is gather the list of groups coupled with names
> and put them in a popup button. This way I can chart items in the log.
> The sorts are instantaneous. Locking the screen doesn't make it go
> faster.
>
> on mouseUp
> set the itemDelimiter to tab
> sort lines of field "Directory" by item 4 of each -- time of day
> sort lines of field "Directory" by item 2 of each -- Task Name
> sort lines of field "Directory" by item 1 of each -- Group Name
> put empty into button "names"
> put empty into vName
> repeat with i = 1 to the number of lines in field "Directory"
> if item 1 of line i of field "Directory" & " " & item 2 of line i of
> field "Directory" <> vName then
> put item 1 of line i of field "Directory" & " " & item 2 of line i
> of field "Directory" into tName
> put tName & return after button "names" -- populate a popup button
> for navigation later
> put tName into vName -- new Group/Task name
> end if
> put i into field "Records" -- show progress
> end repeat
> end mouseUp
>
> I'm eventually going to have a hugh number of lines to process. This way
> will be too slow even though it only needs to go through the repeat loop
> once as the Group and Task names will already be sorted.
>
> Is there a faster way?
>
> Bill Vlahos
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list