Optimizing scripts in LC is not the same as running reports in other software suites. If you only need 10 results, you probably don't want to handle all items twice.

I hate to loop through all items even once. But if I do, I may be done! I'm not making a full report to print out; I'm just getting my 10 items. If I use sort or filter, likewise, I will do whatever necessary to keep it short and sweet, even if that means adjusting some of the starting assumptions.

If the sort really is taking more time than the loop, something is bogging it down. Look at the random() and arithmetic attached to the sort. That's potentially like running a whole lot of LCS. So if you sort, try a plain numeric sort with no fancy stuff added. Then go grab your 10 - the other requirements can be addressed before or after the sort.

Best wishes,

Curry Kenworthy

Custom Software Development
LiveCode Training and Consulting
http://livecodeconsulting.com/

_______________________________________________
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