SC, Rev,and RB speed test
Brian Yennie
briany at qldlearning.com
Fri Apr 16 13:32:10 EDT 2004
Chris,
Here's one more shot, which uses a pretty simple trick: it first
crumples everything down into the first two characters of a word and
does a rough comparison on that. If that passes, then and only then
does it look for an exact match. It also only considers the first 3
words of the search string on first pass, which seems fairly optimal
for weeding out the non-matches.
on mouseUp
local stubs,stList,theText,shortList,shortFind,MatchList,sMS,sTicks,w
put fld "TargetText" into theText
put "" into fld "TheResults"
put field "SearchTextList" into stList
put the milliseconds into sMS
put ticks() into sTicks
repeat for each word w in theText
put (char 1 to 2 of w) after shortList
end repeat
repeat for each line stLine in stList
put empty into shortFind
repeat for each word w in (word 1 to 3 of stLine)
put (char 1 to 2 of w) after shortFind
end repeat
put offset(shortFind, shortList) into tPossible
if (tPossible > 0) then
if (offset(stLine, theText, tPossible) > 0) then
put stLine & cr after MatchList
end if
end if
end repeat
put MatchList into fld "TheResults"
put the milliseconds - sMS && "ms" & return && "(" & ticks()-sticks
&& "ticks)" & return before cd fld "SpeedRecords"
end mouseUp
> Mark Brownell wrote:
>> I once asked for a high speed pull-parser that could get a single
>> element set and get a single element set after point X. This high
>> speed
>> pull parser could also split by single element, start tags only, but
>> better by element tag sets. It is possible to do all this with offset
>> functions in Transcript. (see below) This start tag would not need to
>> use "<" & ">" characters but could be any chunk. So this pull-parser
>> could also be a high speed search tool that builds arrays like the
>> split function's result.
>
> Whew! I'm going to have to study that one. In the meantime, I did put
> some realistic data up on my speedtest page:
> http://www.yav.com/speed.html
> Thanks for the comments,
> Chris
> _______________________________________________
> 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