This is a long thread and I can't read it at the moement,, and maybe you have answered this.
But what prevents you from loading all your data into an array? and just iterating over the keys or index of an array? vs the lines of a long list.? That will yield the fastest performance. I should have a full reda of the thread, there are always nuggets of gold to be found :) On Thu, Mar 3, 2022 at 8:37 AM Pi Digital via use-livecode < use-livecode@lists.runrev.com> wrote: > I usually test this by using > > put the milliseconds into tMs > …loop code… > put the milliseconds - tMs > > This shows me a record of how long that loop took and helps me narrow down > where the slow downs are occurring. You can do it within the loop too and > keep a record for each iteration and see if it has a problem as it gets > further down the list. But not likely with arrays. > > Sean Cole > Pi Digital Productions Ltd > > eMail Ts & Cs > > > > On 3 Mar 2022, at 06:53, Mark Waddingham via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > > On 2022-03-02 21:57, J. Landman Gay via use-livecode wrote: > >> 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. > > > > If the difference between `the milliseconds` before the loop, and then > after is 0 or 1 millisecond - then that is how long it is taking. This > means the issue is somewhere else. Are you sure there isn't anything you > are doing either before that loop or after that loop which doesn't wait for > ages (due to the ANRs you mentioned). > > > >> 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. > > > > If there are only 3 reasonable length words in pList (I.e. 3 lines) then > there's no way that loop can take 4 seconds. Of course if the words are > multiple megabytes long then it might be possible (however the timing you > already stated above suggests the loop isn't actually taking 4 seconds!). > > > >> 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. > > > > This strongly suggests it is something else either on your phone, or in > your code which your phone doesn't like I think. > > > > Warmst Regards, > > > > Mark. > > > > -- > > Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/ > > LiveCode: Everyone can create apps > > > > _______________________________________________ > > 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 > _______________________________________________ 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