You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like you should open a PR for this altered implementation.
However, my initial suspicion is that this will very rarely lead to the wrong result. I expect that the lt(o, a[n], x) ? n + 1 : n switch in the original is necessary to correct for very rare rounding "errors" that would lead to off-by-one results. I imagine (hope?) we have some tests for such cases, which a PR would be evaluated against.
I get a good speedup by the following change (here
searchsortedfirst1
is the function copied from Base.Sort).n1 == n2 = true
n1 == n2 = true
27.236 ns (0 allocations: 0 bytes)
13.614 ns (0 allocations: 0 bytes)
n1 == n2 = true
n1 == n2 = true
27.035 ns (0 allocations: 0 bytes)
17.735 ns (0 allocations: 0 bytes)
The text was updated successfully, but these errors were encountered: