Better than tables, better than delimited lines?

Richard Gaskin ambassador at fourthworld.com
Fri Apr 22 03:04:06 EDT 2005


Sarah Reichelt wrote:
>> These all make sense to me in what I am doing but I want a visual 
>> field to do my testing and was wondering if there is a better 
>> recommended way to handle many calls to a field by line first then 
>> first three items and then finally by last three to seven items? 
>> Again, I used to use comma delimited items with CR delimited lines in 
>> a text document but that was rather cumbersome with a few thousand 
>> lines. I eventually split it up to be easier to read through and fix 
>> errant key entries and action items.
>>
> The filter command should be able to do what you want very quickly e.g.
> filter fld "Data" with myKey1 & comma & myKey2 & comma & myKey3 & comma 
> & "*"
> will give you only the lines that start with the 3 specified keys.
> Then you can loop through a subset of the original data.
> 
> While custom properties may be faster, I prefer to do my initial 
> development with the data in a visible and easily editable form. Even 
> later on, I still find that this is often the best way as retrieving & 
> setting the data is rarely the speed limiting step.

Good stuff, Sarah.

In my benchmarking, custom properties are only faster than a delimited 
list for random access of specific items.  If you need to walk through 
all elements ("repeat for each element...") or lines ("repeat for each 
line...") it turns out that arrays are slower than lists by about 
15-20%, and slightly slower than that if stored in props rather than in 
an array variable.

I would be interested in seeing the original poster's script for 
querying items in a delimited list.  Reported as cumbersome, I'm 
confident some of the folks here could optimize it for very satisfying 
performance.

I've been doing some testing with some complicated queries of delimited 
lists and have been able to do a three-criteria evaluation ("if item 1 
contains x and item 3 contains y and item 6 is not in x") of each line 
in a list of 40,000 lines in under two seconds on a modest 1GHz machine.

-- 
  Richard Gaskin
  Fourth World Media Corporation
  __________________________________________________
  Rev tools and more: http://www.fourthworld.com/rev


More information about the use-livecode mailing list