> Access to items in property lists is typically faster than linear lists.

I don't think so. All tests are fallible, but try this - it seems that
linear lists have a very slight edge over accessing a prop list by position,
and a much better edge over accessing a prop list through a property.

-----------
on testTime
  pl = [:]
  ll = []
  repeat with i = 1 to 10000
    pl.addProp(symbol("hold" & i), i)
    ll.add(i)
  end repeat
  
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    x = pl[i]
  end repeat
  put "property list, by position:" && the milliseconds - temp
  
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    x = pl[z]
  end repeat
  put "property list, by property:" && the milliseconds - temp
  
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    y = ll[i]
  end repeat
  put "linear list:" && the milliseconds - temp
  
  sort(pl)
  sort(ll)
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    x = pl[i]
  end repeat
  put "property list, by position, sorted:" && the milliseconds - temp
  
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    x = pl[z]
  end repeat
  put "property list, by property, sorted:" && the milliseconds - temp
  
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    y = ll[i]
  end repeat
  put "linear list, sorted:" && the milliseconds - temp
  
end 
--------------------

testTime
-- "property list, by position: 908"
-- "property list, by property: 4480"
-- "linear list: 902"
-- "property list, by position, sorted: 906"
-- "property list, by property, sorted: 1290"
-- "linear list, sorted: 901"

-- "property list, by position: 902"
-- "property list, by property: 4450"
-- "linear list: 902"
-- "property list, by position, sorted: 904"
-- "property list, by property, sorted: 1284"
-- "linear list, sorted: 901"


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to