SC, Rev,and RB speed test
Geoff Canyon
gcanyon at inspiredlogic.com
Thu Apr 15 09:45:11 EDT 2004
Ken, by using the keys function aren't you also optimizing on the fact
that the search string is highly redundant? It's not technically
against the rules here, but obviously in a real world situation would
likely fall over. That said, if you get the keys once before the repeat
loop you save about 25% (in my tests):
on mouseUp
local tFind,tSearch,tLine,tMatchList,tTicks
put "" into fld "TheResults"
put the milliseconds into sMS
put field "SearchTextList" into stList
repeat for each line tLine in fld "TargetText"
put "" into tMatchList[tLine]
end repeat
put keys(tMatchList) into tMatchList
repeat for each line stLine in stList
if stLine is in tMatchList then put stLine & cr after MatchList
end repeat
put MatchList into fld "TheResults"
put the milliseconds - sMS && "ms" into cd fld "SpeedRecords"
end mouseUp
regards,
Geoff Canyon
gcanyon at inspiredlogic.com
On Apr 14, 2004, at 10:31 PM, Ken Ray wrote:
> Here's a winner using your test stack:
>
> on mouseUp
> local tFind,tSearch,tLine,tMatchList,tTicks
> put "" into cd fld "TheResults"
> put the milliseconds into sMS
> put cd fld "TargetText" into theText
> put field "SerachTextList" into stList
> repeat for each line tLine in theText
> put "" into tMatchList[tLine]
> end repeat
> repeat for each line stLine in stList
> if stLine is in keys(tMatchList) then put stLine & cr after
> MatchList
More information about the use-livecode
mailing list