Arrays: new and old keys, i

Richard Gaskin ambassador at fourthworld.com
Sun Sep 14 06:31:23 EDT 2008


Mark Smith wrote:
> I believe that it's in the nature of hash tables (which is what Rev's  
> arrays are, I think) that they do not preserve the order of keys.
> If so, then the engine would have to maintain an ordered index  
> separately. This would likely affect performance, so perhaps  we  
> wouldn't always want it...

For accessing specific elements from large collections, arrays 
outperform any lineoffset in lists or any other method I can think of by 
several orders of magnitude.*

Read, "It's a good hash mechanism". :)

When I need ordinal sequential access, I use ordinal keys.  Am I some 
sort of freak?



* The split and combine commands are enormously costly, however, so the 
value of the blinding speed of the array hash is best exploited with 
data sets that live natively in arrays, rather than in delimited lists 
converted to arrays only temporarily.

-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list