I do have one more suggestion for you. Any time you reference into a sublist more than once, Lingo has to rebuild a reference to the sublist. If you are going to go into a sublist multiple times, I'm sure it would be faster to set a temporary variable to the sublist and pull out values from there. Here's a specific case. In your second routine:
on filterList sList, filterStr
rList = []
mx = count (sList)
repeat with k = 1 to mx fName = [sList[k].area, sList[k].team, sList[k].player,
sList[k].points ]
if sList[k].team =filterStr then append rList, fName
end repeat
return rList
end
I would bet it would be faster to do something like this:
on filterList sList, filterStr
rList = []
mx = count (sList)
repeat with k = 1 to mx
subListName = sList[k] -- store reference into a local variable here
fName = [subListName.area, subListName.team, subListName.player,
subListName.points ]
if subListName.team =filterStr then append rList, fName
end repeat
return rList
endSince lists are "pass by reference", if you execute a statement like the above:
subListName = sList[k] -- (use whatever name is appropriate here)
you are NOT duplicating any data. Intead, you are setting this new variable (subListName) basically as a "pointer" to the appropriate place in the original list. This would save the time of dereferencing your current sList[k] five times in this routine alone.
Actually, now that I look at this code closer, there is another optimization you can do. You don't even need to build up your fName list unless the team matches the filterStr. So only build it conditionally:
on filterList sList, filterStr
rList = []
mx = count (sList)
repeat with k = 1 to mx
subListName = sList[k] -- store reference into a local variable here
if subListName.team =filterStr then
fName = [subListName.area, subListName.team, subListName.player,
subListName.points ]
append rList, fName
end if
end repeat
return rList
endYou could probably use the same approach (using a local variable pointing into your list structure) in your html generation where you are using templist[i][j][1] twice in the same doubly nested repeat loop. Set some local variable to that:
someLocalVariable = templist[i][j][1]
then replace the current instances with the local variable.
However, I'm sure that Alex's suggestion of building the whole thing as a string variable, then putting it into the text of a member will have the most immediate impact.
Irv
At 11:59 AM +0000 1/23/04, Lee Blinco wrote:
Hi folks, i am developing an application that takes in a load of footy score predictions and then calculates points for each prediction once the games have been played, it then works out the winners etc. Another factor is that
<snippage> --
Multimedia Wrangler.
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
