Optimization can be tricky

Ralph DiMola rdimola at evergreeninfo.net
Tue Jun 12 16:55:41 EDT 2018


Filter is lightning fast. I have the list of all 40,000+ cities in the US
and have a predictive search field. I tried DBs, in memory DB and other
methods until I stumbled on to the filter operator. Load a text file into a
var and the start filtering. There is no perceptible delay when typing the
first few letters of a city name. I even carry some meta data along for the
ride.
I don't know if it can  be used here. I have not had the time to look at the
code or the problem presented. 

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of hh via use-livecode
Sent: Tuesday, June 12, 2018 4:39 PM
To: use-livecode at lists.runrev.com
Cc: hh
Subject: Re: Optimization can be tricky

The scenario Geoff described is roughly to get the top ten (a handful) of
2000 records comparing a certain numeric value of each.
To get that unknown value of each one has to go once through all the records
*and then sort* for that ranking.
(LiveCode is very fast with a simple numeric sort!) Any other method of
ranking while going through the data will generously waste CPU time.

> Curry wrote:
> 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. :)


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





More information about the use-livecode mailing list