Welcome to the SRP Forum! Please refer to the
SRP Forum FAQ post
if you have any questions regarding how the forum works.
Locate...By Statement question
According to the documentation, this function assumes that the data are sorted. Does this mean that the locate by statement uses binary search to locate the element in the array?
No. It scans from the top. It is slooooooowwwwww for large sets of data.
So OI has no binary search? I guess it can't have it, as you can't randomly access an element?
edited July 5
Correct. It's just a string. Now, if you are just doing a single locate, even on big data, it can be faster than a regular locate because it will know the element doesn't exist once it finds an element that comes alphabetically after the search target. But, if you're using Locate...By in a loop to build a sorted list, it can get pretty slow.
as it seems you are experimenting and using large data sets, it might be worth it for you to check out
this little FastArray nugget
provided by SRP.
Only you can determine whether or not it is beneficial to you.
Hi, yeah i know about that tool. I was trying to keep as many things inside of vanilla oi as possible though.
Anyway, I don't need binary search, I will just use the index function to find what I want. It's fast enough.