On Fri, Jan 6, 2017 at 7:24 PM, Tim Nevels <[email protected]> wrote:

> I’ve done a little work in this area. From my perspective you have 2
> choices:
>
> 1. Write code that will take an ARRAY OBJECT parameter and walk the array
> scanning each object element for the value you want. I think of this like
> doing a sequential search on records. You’d have to do some profiling to
> see if there were any performance issues with big arrays and/or big objects.
>
> 2. Build your own index for the object array. An ARRAY TEXT with values
> and an ARRAY LONGINT storing the element number. I think of this like an
> indexed search.
>
> I chose to use method 2 in the project I did. It’s super fast to do a
> “Find in array” on the text array, and then use the corresponding longint
> array value to retrieve the object array element number. And it scales well
> with big arrays and big objects.
>

Tim:

You've hit it on the head.

I say that because that's pretty much how ObjectTools evolved. It started
as sequential and then moved to using an index.

Early versions of OT read the object until it hit a matching tag. That
worked well for small objects but, as it turns out, developers found a way
to it slow down.

Some members on the server team at PowerSchool took OT to the limit by
creating objects that were sufficiently large and/or complex that there was
a performance hit. Apple contacted Aparajita about it and, for a "small
fee", he agreed to revamp the architecture of OT, then in version 2.

Version 3 of ObjectTools had an internal index and performance went up
markedly. Version 3 OT objects were larger than their v2 counterparts but
that was due to the index structure that Aparajita added.

To your point, even when searching something in RAM (despite my admonition
of "Nothing is slow at 3 Ghz.") you can get to a situation where a
sequential read doesn't cut it. When that happens, indexing is the next
option.

--
Douglas von Roeder
949-336-2902
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to