Several methods of the searchsorted family of functions are undocumented. One example is searchsorted(v:AbstractArray{T,1} where T, x, ilo::Int64, ihi::Int64, o::Base.Order.Ordering). It would be nice if these were documented.
Or not exposed accidentally. We should make those internal—better to use views for that functionality.
Ok, I see now that the needed ordering structs aren’t exported either. So it makes sense.
I have to say that I would have liked to have the method with ‘hi’ and ‘lo’ boundaries available. In my case I often need the index of the original large array and my code turned out both faster and cleaner (IMO) by using this method of ‘searchsortedfirst’.
Have you tried using views to limit the portion of the array that you're working with? That's the more composable approach but we're not 100% on eliminating overhead for view creation yet.
Yes, I have tried using views and that works great. I just noticed that the execution time dropped slightly more when I changed my code to using the searchsorted method with bounds.
However, I don’t think this difference in execution speed is large enough to be important in most cases. It just seemed to be the right method for my needs, but I do appreciate that it might make more sense to keep the public api clean and make these methods internal.
Most helpful comment
Or not exposed accidentally. We should make those internal—better to use views for that functionality.