Optimization can be tricky
Curry Kenworthy
curry at pair.com
Tue Jun 12 15:30:57 EDT 2018
Put yourself in the computer's shoes, and also clarify what you need to
accomplish. You are asking it to sort the entire list of 2000 records,
but (if I understand) you only want a handful of those.
And it has already gone through all the records once before the sort. If
you asked a human to do that, it would be a risky interaction. There
might be raised voices when they present the neatly arranged file
cabinet with files in a special order, and you deliver the punch line
that you only need to pull a few. If you only need to pull 5 records,
most people don't want to go through all 2000 files - twice.
So generally, don't use a sort after doing a complete loop on a big text
list, use another method. Do unto your computer as you hope it will do
unto you when they run the world. :)
(But I would be interested in the speed of your original code on LC 9 vs
LC 6.7, just to see how engine optimization is faring. I'm surprised it
took a minute.)
Best wishes,
Curry Kenworthy
Custom Software Development
LiveCode Training and Consulting
http://livecodeconsulting.com/
More information about the use-livecode
mailing list