AW: fastes way to search an array?

Tiemo Hollmann TB toolbook at kestner.de
Thu Apr 23 04:09:49 EDT 2015


Thanks Richard and others for you helpful remarks
Tiemo


-----Ursprüngliche Nachricht-----
Von: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] Im Auftrag
von Richard Gaskin
Gesendet: Mittwoch, 22. April 2015 18:04
An: use-livecode at lists.runrev.com
Betreff: Re: fastes way to search an array?

Tiemo wrote:

 > I have an array with 20000 records, where I want to extract all  >
records, which either "begins with" or "contains" a search string.
 >
 > Up to now I just loop thru the whole array, do the compare and  > extract
the result records. I wonder, if there is a way to speed  > up this search?
E.g., does it makes a difference, if I compare the  > string in the key or
the data of the array while looping thru? I  > mean, would it make a
difference, if I would create an "associative"
 > array, where my search looks up in the keys of the array, either by  >
looping thru the array, or by extracting first the keys of the array  > into
a separate variable, instead in the data of the original array?
 >
 > Would it make a difference looping thru a variable, which just  >
contains the keys of the array, instead of looping thru the complete  >
array, because of the smaller "footprint" in the memory?
 >
 > Or shouldn't I care about these differences and just let LC makes its  >
job?
 >
 > Any experiences welcome,

I'm not entirely sure I understand the options you've described, but
hopefully this will at least either help or be mildly amusing:

   go url "http://fourthworld.net/lc/array_access_speeds.livecode"

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com

_______________________________________________
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