-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slow searchsorted due to keyword argument #8991
Comments
I think the performance hit actually comes not from the keyword arguments (which might cause a hit if a keyword argument is passed, but shouldn't if none are passed), but from absence of type information for the ordering returned by julia> @code_typed searchsortedfirst(-5.0:5.0,1.0)
1-element Array{Any,1}:
:($(Expr(:lambda, Any[:v,:x], Any[Any[],Any[Any[:v,FloatRange{Float64},0],Any[:x,Float64,0]],Any[]], :(begin $(Expr(:line, 219, symbol("sort.jl"), symbol("")))
return searchsortedfirst(v::FloatRange{Float64},x::Float64,ord(isless::F,identity::F,false,Forward::ForwardOrdering))::Int64
end::Int64)))) |
Keyword arguments are no longer the problem here, but this has indeed gotten much slower. |
I now note with 0.7-alpha, that we are slightly better than 0.6. (2.8 sec on 0.7-alpha). |
Almost all of the time here is in constructing the range, probably because ranges have gotten much more sophisticated. In the case of 2-argument I'll close this and open a new issue, since the part specific to searchsorted is fixed. |
The keyword argument in
searchsortedfirst
/searchsortedlast
causes a performance hit when used repeatedly, even when no keyword argument is used in calling:cf: #8952
The text was updated successfully, but these errors were encountered: