"Filter" is a wonderful command that's almost always much faster than "repeat for each...", provided you're looking for data across a collection comprised of single-column rows.

Once you get to multiple columns and you're searching just one of them, "repeat for each..." scales linearly quite nicely but the performance of "filter" degrades almost geometrically.

This is understandable given what regex is designed for: any generalized solution optimized for the programmer's convenience will be doing a lot of work under the hood.

Many aspects of LiveCode are seductive that way, leading us to believe that the less typing we're doing the more efficient our code will be.

While often true there are many exceptions, and the dynamic compiler can be surprisingly efficient at times.

There are even cases where "repeat for each" on simple chunks is faster than array traversal, if the array is nested deeply enough.

--
 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