P.S. on searching for chars within a string

J. Landman Gay jacque at hyperactivesw.com
Wed Sep 24 12:30:09 EDT 2014


On 9/24/2014, 2:20 AM, larry at significantplanet.org wrote:
> I am using a for each loop and have run some benchmark time tests. I am
> able to find (match) the words I want in about 1/7 of the time that it
> used to take me using a different procedure - and the old way was pretty
> fast!  To find all the smaller words (length of 2 - 7) contained in a
> 12-ltr word, it used to take 3.46 seconds. Now it only takes 0.56 seconds.

Yesterday I tinkered with this:


function getMatch pString,pSource
   put len(pSource) into tSourceLength
   repeat for each char c in pString
     delete char offset(c,pSource) of pSource
   end repeat
   return len(pSource) = tSourceLength - len(pString)
end getMatch

It may or may not be faster than your current method. On my Mac it can 
do 10,000 lookups in about 350 milliseconds.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list