>>> 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.
> 
> No arguments, Kurt. There are indeed cases where linear lists are faster,
> like when you know the position of the item you are retrieving.
> 
> Again, I am guilty of over-simplification, but at least this time I said
> "generally" :-)
> 
> Let me put it another way--access to items in property lists is faster when
> you're matching a value.
> 
> A fair test would be to compare getOne() with getProp(). You will find the
> property list much faster. A sorted linear list will be faster than
> unsorted, of course, but still not as fast as a property list.

Fair enough - I just can't let a blanket statement like that one go by
without playing devil's advocate. I still think you're wrong, though.
Perhaps my test isn't fair (and I'm not trying to bust your balls here, just
looking to clarify things for myself as well as others), but - this is in
the authoring environment, and I haven't tried it in a projector:

-----
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 = getProp(pl, z)
  end repeat
  put "prop list getprop:" && the milliseconds - temp
  
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    x = getAProp(pl, z)
  end repeat
  put "prop list getAprop:" && the milliseconds - temp
  
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    y = getOne(ll, i)
  end repeat
  put "linear list getOne:" && the milliseconds - temp
  
  temp = the milliseconds
  repeat with i = 1 to 10000
    z = symbol("hold" & i)
    y = getPos(ll, i)
  end repeat
  put "linear list getPos:" && the milliseconds - temp
end 

-----

testTime
-- "getprop: 5853"
-- "getAprop: 5849"
-- "linear list getOne: 5217"
-- "linear list getPos: 5200"

-- "getprop: 5852"
-- "getAprop: 5848"
-- "linear list getOne: 5207"
-- "linear list getPos: 5243"


[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