I am not sure if Android or MacOS can use sqLite memory databases, but when I 
need to iterate through a large array, I first convert the array to an sqLite 
memory database, then query it, which is a gazillion times faster than 
iterating through an array. 

I have functions which create an sqLite database from an array, then convert it 
back to an array again. 

Bob S


> On Mar 2, 2022, at 13:57 , J. Landman Gay via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> In my Boggle game I have an array containing dictionary words as keys, split 
> as set, so all values are "true". I need to compare those keys with a list of 
> user words and get back a list of good words and a list of illegal words.
> 
> The loop takes forever. Here it is (sDictFile is a script local):
> 
>  repeat for each line l in pList -- pList is the user word list
>    if sDictFile[l] = true then put l & cr after tCheckedList
>    else put l & cr after tNonWords
>    wait 0 with messages  -- prevent ANRs
>  end repeat
> 
> I added the wait because my Android phone was putting up an "app not 
> responding" warning while the loop was running (or just after, hard to tell.) 
> The loop should be much faster than that. When I added some timing checks 
> though, the timer says the loop takes between 0 and 1 millisecond, and yet 
> the wait on screen remains.
> 
> With a 3-word user list, the loop takes 4 seconds. With an 8 word user list 
> the loop takes 6 seconds. The more user words, the longer the wait.
> 
> Even stranger: on my cheapo Android tablet with 4 megs of RAM running Android 
> 9 the response is nearly instantaneous, even if the user list has 200+ words. 
> On my Pixel phone with 8 megs of RAM and Android 12 the response is slow 
> enough to trigger the ANR with only 3 words. I'm building for ARM 64.
> 
> I've tried any number of workarounds without luck, on both LC 9.6.6 and LC 
> 10.0.0. Any ideas? I have a feeling it isn't the script per se, it's 
> something else.
> 
> -- 
> Jacqueline Landman Gay         |     jac...@hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.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


_______________________________________________
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

Reply via email to