SC, Rev,and RB speed test

Ken Ray kray at sonsothunder.com
Thu Apr 15 01:51:16 EDT 2004


> 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
>   end repeat
>   put MatchList into cd fld "TheResults"
>   put the milliseconds - sMS && "ms" into cd fld 
> "SpeedRecords" end mouseUp
> 
> Running this on my 1GHz G4 was ** 50 milliseconds **. 

Note that this is only true because you have the same sentence over and over
again in the TargetText field. This collapses down to two elements so the
search is super-speedy. If you anticipate having a lot of duplicate lines in
the TargetText, this is a good way to go, but if you anticipate everything
being different, this is *not* the way to go (and is actually slower).

Just FYI,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/




More information about the use-livecode mailing list