custom property searching speed question
BNZ2 at CDC.GOV
Wed Mar 2 16:02:38 CST 2005
Does filter work on an array?
Anyway, I experimented with a customproperty set created to contain
500,000 elements - each element contains like 7 words. Only the very
last element contains the word "nonstandard"
So far, the following script is fastest:
put the milliseconds into M
put field "search text" into ST
put the customproperties of field "theData" into myArray
repeat for each element E in myArray
if matchchunk(E,ST) = true then
put E into field output
put the milliseconds into M2
put (M2 - M)/1000 into field "feedback"
Each element was created so that the name of that element is the first
word of the element - meaning I do not have to keep track of which
element we are dealing with - as long as I have the value of the
element, I automatically have the name of the element as well.
If the word being searched for is in the 500,000th element of the custom
property set, then it takes 1.059 seconds to find (with like 4 other
programs running on my computer at the same time)
If the elements are already combined into a single variable, then
lineoffset takes just as long!
I guess repeat for each is exceedingly fast.
If I could figure out how to use filter on an array - and how to get it
to work in the same way as using "contains" then I would test it with
the filter command - but so far this eludes me.
In my experiements with this, it seems that an if-then structure was
faster than a switch structure - is this always true?
More information about the use-livecode