How to filter a big list
Jérôme Rosat
jrosat at mac.com
Fri Oct 23 13:55:26 EDT 2009
Mark,
My text file is a "raw" file. When I open a stack, I create a simpler
tab list.
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.
Jerome Rosat
Le 23 oct. 2009 à 19:13, Mark Wieder a écrit :
> Jérôme-
>
> Friday, October 23, 2009, 8:51:18 AM, you wrote:
>
>> If some body in the list is looking for a file with names and address
>> (400K lines), I create a file with french name, French, Spanish,
>> Italians, Portuguese first name and address of Geneva in Switzerland.
>> It is possible to download here: http://files.me.com/jrosat/tac1b4
>
>> In the state of my tests, here the my “fastest” code:
>
> Since you seem to want to limit the display to 60 lines, here's a much
> faster version. This takes roughly 90 milliseconds to do an entire
> list, irrespective of the number of chars. Note as well that your text
> file is actually delimited by commas rather than tabs.
>
> -- time of the filtered list
> on keyUp
> local vListe
> local tTime
>
> put the milliseconds into tTime
> put test1(vNoms) into vListe
> put the milliseconds - tTime into field "fElapsedTime"
> put vListe into field "fListe"
> end keyUp
>
> function test1 pNoms
> local vListe
> local x
>
> set the itemdelimiter to comma
> put empty into vListe
> put 1 into x
> repeat for each line theLine in pNoms
> if item 2 of theLine contains me then
> put theLine & cr after vListe
> add 1 to x
> if x > 60 then
> put "..." & cr after vListe
> exit repeat
> end if
> end if
> end repeat
> return vListe
> end test1
>
> --
> -Mark Wieder
> mwieder at ahsoftware.net
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list