How to filter a big list

Mark Wieder mwieder at ahsoftware.net
Fri Oct 23 15:20:56 EDT 2009


Jérôme-

Friday, October 23, 2009, 10:55:26 AM, you wrote:

> Your code is much better for the 1 to 3 chars. But, if the name you
> search is at the end of the list (for example "rosat") it takes more
> time than my code.

Well, of course. There's no "rosat" in the data set, so you have to go
through the entire thing 400,000 lines than limiting it to 60 hits. In
that case yours is faster because you've already trimmed your data set
down by the first three chars. But you lose that advantage the first
three times through.

You might try something like

    put test1(vNoms) into vListe
    -- add this:
    if the number of lines in vListe < 60 then
        put vListe into vNoms
    end if

so that you only go through the whole list once.

Search optimization would require foreknowledge of the data set.

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list