Speed up a slow loop

Jerry Jensen jerry at jhjensen.com
Thu Mar 3 00:39:21 EST 2022

I did not know about filter! I think I am cured of my “among” disease.

> On Mar 2, 2022, at 7:29 PM, Ralph DiMola via use-livecode <use-livecode at lists.runrev.com> wrote:
> I ran into this when doing mobile predictive typing for US cities(40,000)
> with a scrollable dropdown of results. I did with a loop in JavaScript in
> html and was instantly fast. So in LC IDE I started with the loop thing and
> it was too slow. There was a 3/4 of a second blip as each character was
> typed. I found that "filter the lines" is blazingly fast. So I built the cr
> list of cities with the city followed by a dash and then the metadata I
> needed (lat/lons). Use the "filter into" form so the original list remains
> unchanged. I do a filter for each character typed. Works like a charm. Now
> LC is as fast as the JavaScript version. 
> When filtering if you want the exact term then search with the dash added at
> the end for the search term.
> "filter" must be using your time machine somehow.

More information about the use-livecode mailing list