P.S. on searching for chars within a string

larry at significantplanet.org larry at significantplanet.org
Wed Sep 24 03:20:46 EDT 2014


Hi Craig,
Thanks for the tip.
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. (finding 1698 
words)  And even better, the new way allows for getting the smaller words 
from a string of, say 30 chars, and it doesn't increase the time much - 
about 0.85 seconds for searching within 30 chars.  With the old way, I 
couldn't even search on more than 12 chars, because it just took too long.
So I learned a lot today!
Larry
P.S. Yes, I am using arrays.

----- Original Message ----- 
From: <dunbarx at aol.com>
To: <use-livecode at lists.runrev.com>
Sent: Tuesday, September 23, 2014 9:10 PM
Subject: Re: P.S. on searching for chars within a string


> Larry.
>
>
> Just read your brute force comment. Not sure how much data you want to 
> compare, but a loop using the "for each" variant will run an awful lot of 
> text in an awfully short time.
>
>
> What about that array thing, just for modernity and compactness/
>
>
> Craig
>
>
>
> -----Original Message-----
> From: larry <larry at significantplanet.org>
> To: use-livecode <use-livecode at lists.runrev.com>
> Sent: Tue, Sep 23, 2014 8:25 pm
> Subject: P.S. on searching for chars within a string
>
>
> Hello again,
>
> I know how to do it with brute force,  but I want to know the FASTEST way 
> to
> find the chars.
>
> Thanks
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode 





More information about the use-livecode mailing list