> The original thread on "Arrays vs Object for Key/Value pair lookups” is a
good case in point. Yes there is a huge
> performance boost in using objects (I hold my hands up - I’m doing it !
LoL), but I’m retaining the use of ‘parallel arrays’
> for much of the code simply because they’re so nice and trackable
everywhere. As David Adam’s say, the performance
> gain is huge but has to be weighed against other priorities.

Hey Peter, my point was arguably the opposite - the performance gains for
using an object instead of a sorted array are *trivial* (best case) and
negative (worst case.) Object setup/teardown is more time-consuming and a
binary search is fast and remains fast even with billions of items. (In
theory.)

Unsorted array searches are just slower by nature...they're sequential so
the pain only gets worse with larger arrays and when you're searching for
elements to the end of the array.

I'm very pleased that 4D now has a native binary search on arrays, and I'm
happy with how it's implemented. It's perfect for everything I needed it
for. Indeed such a thing earlier this year, rewrote an old Dave Terry tech
note, posted the code here and...someone quickly said, "Urrrr, have you
seen the Language Reference lately?"

If anyone out there doesn't understand why binary searches are faster (so
much faster) than standard sequential scans, and why they depend on sorted
values, it's easy to understand. Google it and you should be able to figure
it out in a few minutes.

And, lest anyone forget, you can use binary search logic on sorted
selections with GOTO SELECTED RECORD. Why not?
**********************************************************************
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