On Thursday, August 28, 2003, at 10:25 PM, Geoff Canyon wrote:


function offsetsOf pSearch,pString -- returns a list of the offsets of pSearch in pString
put empty into tReturn
put 0 into tOffset
repeat
put offset(pSearch,pString,tOffset) + tOffset into tNewOffset
if tNewOffset is tOffset then exit repeat
put tNewOffset & space after tReturn
put tNewOffset into tOffset
end repeat
delete char -1 of tReturn
return tReturn

Like this: from my frogBreath.rev speed test from a few weeks ago...
put: go url "http://www.gizmotron.org/frogbreath.rev"; into the message window with a active internet connection.


on mouseUp
global theArray
put "" into theArray
put the customProperty of button "Button 4" into tZap
-------- this gets the XML document from the customProperty
put the milliseconds into tStartTime
put 0 into tStart
put 1 into tElementNum
repeat with x = 1 to 235
put offset("<record>",tZap,tStart) into tNum
put (tNum + tStart) into tStart
if tNum < 1 then exit repeat
put tStart into gWordArray1[tElementNum]
add 1 to tElementNum
end repeat
put 0 into tStart
put 1 into tElementNum
repeat with x2 = 1 to 235
put offset("</record>",tZap,tStart) into tNum
put (tNum + tStart) into tStart
if tNum < 1 then exit repeat
put tStart into gWordArray2[tElementNum]
add 1 to tElementNum
end repeat
repeat with x3 = 1 to 235
put gWordArray1[x3] into zip
put gWordArray2[x3] into zap
put char (zip + 8) to (zap - 1) of tZap into zapped
put zapped into theArray[x3]
end repeat
put (the milliseconds - tStartTime) into btTwoTime
--answer
put "PNLP to theArray took -- " & btTwoTime & return into field "mainText"
put theArray[1] & return after field "mainText"
put theArray[2] & return after field "mainText"
put theArray[3] & return after field "mainText"
end mouseUp


I know that it can be done in transcript. I just want a faster array built in whatever language Revolution is built in. Maybe the string class in C++ has some find char capabilities that can build the arrays real fast without the need for a repeat loop in transcript. This was a wish list item I was looking for.

If I needed to do a parallel numerical search of 3 to 10 megabytes of text data then a loop in transcript would start to lag over the speed of a C++ native function. I've proven this with the TextCruncher Xtra for Director. This Xtra was coded using C or C++ to add speed to string searches. It has a feature findAll() and creates an array in half the time as the transcript loop. I'm just looking for some speed here. I've moved on from Director.

Mark Brownell

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to