Filtering array vs plain list

Jim Ault JimAultWins at
Sat Feb 2 12:35:47 EST 2008

What you are doing looks fine.

The speed depends on a few factors, which Richard Gaskin very carefully
studied about month or two ago.   His analysis was thorough and correct, and
his suggestions were right on the mark for optimizing the performance of the
filter command.

Filter works faster if the patterns are simple and operate on the left most
data.  Shorter lines = faster processing.

(suggestion:  never use a variable name that is also reserved word in the
computer language you are using, in this case Rev.)
thus don't use  {  a   item   word  filter  image   btn  fld   }
use "aaa" "bbb" "ccc" "itemm"  "wordd" "fldd" "nonreserved"

Jim Ault
Las Vegas

On 2/2/08 7:49 AM, "Shari" <shari at> wrote:

>>   personName[3258] = "Billy Bob"
>>   birthyear[3258] = 1982
>> Intersecting the values you get from retrieving each array/key combo gives
>> you the identifiers for all the people who match all your selection
>> criteria, as many as you care to specify.
> I've just about got it.  You gave me a good jumping board, Dick.
> Here's where it sits.  Using one single array (this allows for the
> best ease of use), data is stored as follows:
> census[1111,team] = Red Sox
> census[2222,team] = Red Sox
> census[3333,team] = White Sox
> census[1111,city] = Chicago
> census[2222,city] = Atlanta
> census[3333,city] = Chicago
> Now, to get a list of folks that live in Atlanta that are Red Sox
> fans, I did the following:
> put census into a
> combine a with return and comma
> filter a with "*,team,Red Sox"
> put census into b
> combine b with return and comma
> filter b with "*,city,Atlanta"
> This gives me:
> a =
> 1111,team,Red Sox
> 2222,team,Red Sox
> b =
> 2222,city,Atlanta
> Can a and b be intersected as is?  (My attempts failed.)  The
> following works beautifully, but is it the most efficient?  Is using
> split/combine/filter to manipulate a giant array faster than a repeat
> loop thru a gigantic list?
>    split a by return and comma
>    split b by return and comma
>    intersect a with b
>    combine a with return and comma
>    answer a
> a =
> 2222,team,Red Sox
> That gave me exactly what I need.  A list of anyone with team(Red
> Sox) and city(Atlanta) with item 1 of each line as the unique
> identifier.
> Any efficiency suggestions are welcome :-)
> Shari

More information about the Use-livecode mailing list