Is there a faster way...

Bill Vlahos bvlahos at jpl.nasa.gov
Fri May 3 11:06:01 EDT 2002


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




More information about the use-livecode mailing list