Julia: Undocumented searchsorted methods

Created on 14 Dec 2018  Â·  4Comments  Â·  Source: JuliaLang/julia

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.

Most helpful comment

Or not exposed accidentally. We should make those internal—better to use views for that functionality.

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ararslan picture ararslan  Â·  3Comments

yurivish picture yurivish  Â·  3Comments

sbromberger picture sbromberger  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments