fastes way to search an array?

Peter Haworth pete at lcsql.com
Wed Apr 22 19:22:04 EDT 2015


Out of interest, I added a test which used combine and filter.  It took
around 3 times longer than the other two tests.


Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Wed, Apr 22, 2015 at 3:51 PM, Richard Gaskin <ambassador at fourthworld.com>
wrote:

> Mike Bonner wrote:
>
>  I wonder how easy it would be to add an option to arrayencode.  It already
>> flattens an array nicely, but not in a searchable way. It would be cool to
>> add an optional argument that still flattens, but doesn't encode.  The
>> code
>> to traverse the array is already there, with an option to leave the data
>> and keys readable, it would then make an interesting batch of searchable
>> text. Just glancing at an encoded array, it looks relatively
>> comprehensible.
>>
>
> Relatively.  Lots of binary stuff there, though - it's relatively slow for
> the engine to recompose into an array, and no doubt much slower to attempt
> to do in script.
>
> May not be much of a need, though, since traversing arrays with what we
> have is pretty fast - from my earlier email:
>
>    go url "http://fourthworld.net/lc/array_access_speeds.livecode"
>
>
>  One issue would be the unordered way arrays are stored. (making
>> arrayencoded arrays come out different despite identical data, as per the
>> dictionary page)
>>
>
> That's a function of the hashing used for any associative array.  Not much
> can be done about that for strings, though there's been some talk of adding
> numerically indexed arrays for those who need only sequential integers as
> keys and need to maintain order.
>
> But in the meantime the sort command is pretty handy. :)
>
> --
>  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