I don't know how they're implemented now, but when FIND was first written at Microdata, it was completely separate so it didn't have to deal with much of the LOCATE overhead.

They should be about the same speed if the array is unsorted as they both have to scan from start to finish and both will stop at the first match.

However, if the array is sorted and you specify ascending or descending in the LOCATE statement, it will stop when a match is NOT found before (usually) the end of the array. So a failure case will usually run faster. If a match ISN'T found, the LOCATE sorted will still be no faster than FIND because both must still search the entire array.

Hope this helps.

Stewart

When using FIND or LOCATE on a dynamic array, is one faster than the other, and is there any reason to sort the array to (hopefully) improve the speed of FIND or LOCATE?

I don't need to use LOCATE... BY... SETTING, I'm just doing a raw FIND or LOCATE.

Barry Brevik
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to