Interesting subject. Just to make sure I am able to interpret the the findings correctly, were you comparing Find in array with object find, or *binary* find in array on a sorted array? Binary search is very hard (but certainly not impossible) to compete with. If you have an array of 1,000,000 elements, it takes something like 36 operations max to find a value. If you have an unsorted array of 1,000,000 items then it can take 1,000,000 comparisons to check for a value.
Kind of a big deal. A naive, sequential Find in array and a smart binary search on a sorted array are *very* different animals. Conflating the two makes search results based on one meaningless. That's why I'm trying to sort out which of these animals you were comparing with searches on objects. Object may be using some kind of hash table which, for sure, ought to beat a sequential find in array. We don't know how many buckets are in the hash table, but say that it's 4,096. You cut your initial search space down to roughly 256 values. (This could be 0 values or it could be 1,000 - it depends on the data and the hashing function.) That gives you a *massive* optimization very inexpensively. It's still hard to beat a binary search under a normal distribution of values and searches, but it's still way faster than a sequential search. Then again, we don't actually know *anything* about the way object searches work in 4D so anything is possible. 4D won't say anything on the subject for reasons they will not discuss. I find this completely puzzling, but there it is. ********************************************************************** 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:4d_tech-unsubscr...@lists.4d.com **********************************************************************