I'll try benchmarking this against Jacque's suggestion of matchChunk.
Filter is normally pretty fast, but I'll have to use the regex version,
and I'm not sure what the speed implications will be.
Benchmark result averages over 10 runs on a 2700-line script:
filter lines of script 2612.6ms
filter script 2572.1ms
matchChunk 2424.3ms
the code:
put "^local.*"&tLocal&".*" into tRegexString
put matchChunk(tScript, tRegexString, tStartPos, tEndPos) into tFound?
if tFound? then
put the number of lines in char 1 to tStartPos of tScript into tLine
end if
filter tScript with regex tRegexString into tFoundScript
# alternate: no appreciable difference in timing
# filter tScript with "local*"&tLocal&"*" into tFoundScript
if tFoundScript is not empty then
put lineoffset(tFoundScript, tScript) into tLine
end if
So matchChunk plus "the number of lines" is faster by ~150 milliseconds
over 2700 lines of text than filter plus lineOffset.
--
Mark Wieder
ahsoftw...@gmail.com
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode