Monte Goulding wrote:
> On 27/07/2013, at 6:15 AM, Richard Gaskin wrote:
>
>>> Using ID is always the quickest way to access anything.
>>
>> Why is that?
>>
>> Mark, Monte - have you guys stumbled across how object references are resolved in the code base?
>
> I haven't really looked into it but it makes sense that an integer
> comparison will be faster than a string comparison. Objects are
> arranged internally as doubly linked lists in the hierarchy of
> objects so to find the actual instance it needs to iterate over the
> objects to find them and compare the id or name to what's being
> looked for.

Yes, I've always believed that name was the slowest option, but it's the iteration that made me thinking that ordinal references would be at least as fast, and possibly faster since the lookup is ordinal by nature anyway but ordinal references require no additional ID comparison.

> There is also the id cache that was introduced a few versions
> ago that keeps track of re-uses of ids and make them faster.

I found that interesting when it first showed up but have been unable to come up with a way to benchmark the improved performance.

Anyone here have a sample script that shows off how well ID caching works?

--
 Richard Gaskin
 Fourth World
 LiveCode training and consulting: http://www.fourthworld.com
 Webzine for LiveCode developers: http://www.LiveCodeJournal.com
 Follow me on Twitter:  http://twitter.com/FourthWorldSys


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to