SC, Rev,and RB speed test
Mark Brownell
gizmotron at earthlink.net
Fri Apr 16 10:48:42 EDT 2004
On Thursday, April 15, 2004, at 08:22 PM, David Vaughan wrote:
>
> I think Richard Gaskin's query is pertinent. The question is very
> close to "find the intersection of two large sets". Is that the crux
> of the real life problem? Are there any other considerations? With
> more information about the real data I believe that we could improve
> the Rev performance in other ways so that it suffered no
> user-recognisable performance handicap in the real world.
>
> regards
> David
I suppose this is as good as anyplace, perhaps better on the improve
rev list...
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.
Mark Brownell
-- put getElementList("<record>", "</record>", yourText) into theArray
function getElementList tStartTag, tEndTag, StringToSearch
put empty into tArray
put 0 into tStart1
put 0 into tStart2
put 1 into tElementNum
put the number of chars in tStartTag into dChars
repeat
put offset(tStartTag,StringToSearch,tStart1) into tNum1
put (tNum1 + tStart1) into tStart1
if tNum1 < 1 then exit repeat
put offset(tEndTag,StringToSearch,tStart2) into tNum2
put (tNum2 + tStart2) into tStart2
if tNum2 < 1 then exit repeat
--if tNum2 < tNum1 then exit repeat
put char (tStart1 + dChars) to (tStart2 - 1) of StringToSearch into
zapped
put zapped into tArray[tElementNum]
add 1 to tElementNum
end repeat
return tArray
end getElementList
-- put getElement("<record>", "</record>", yourText) into theElement
function getElement tStTag, tEdTag, stngToSch
put empty into zapped
put the number of chars in tStTag into dChars
put offset(tStTag,stngToSch) into tNum1
put offset(tEdTag,stngToSch) into tNum2
if tNum1 < 1 then
return "error"
exit PNLPgetElement
end if
if tNum2 < 1 then
return "error"
exit PNLPgetElement
end if
put char (tNum1 + dChars) to (tNum2 - 1) of stngToSch into zapped
return zapped
end getElement
More information about the use-livecode
mailing list