Alex Tweedly wrote:
Yes, here's an example. The clue (I think) is in the "linear time...into constant time"Create a large-ish number of controls - in this stack I cloned a button 1000 times, calling them BBB1 BBB2 .... BBB1000 Then this code accesses a single control many times - and shows that accessing by id is much faster than accessing by name, but more importantly here, that in 6.0 access by id to the most recently accessed control is very fast. in 5.5.3 name takes 830 ms while id takes only 250 ms but in 6.0 (i.e. with id caching) name takes 830 ms while id takes 5 ms -- Alex. global K on mouseUp put 1000 into K put the millisecs into t1 put "BBB"&(K-10) into tName repeat 10000 times put the short name of control tName into t end repeat put the millisecs-t1 && t &CR after msg put the millisecs into t1 put the id of button tName into tID repeat 10000 times put the short name of control id tID into t end repeat put the millisecs-t1 && t &CR after msg end mouseUp
Nicely done, Alex. Thanks! -- Richard Gaskin Fourth World Systems Software Design and Development for Desktop, Mobile, and Web ____________________________________________________________ [email protected] http://www.FourthWorld.com _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
