Specialized Base.findfirst for ranges

As far as I see at the moment julia uses the same findfirst method for all AbstractArray which simply iterates through all the items. Would it not make sense to have specialized method for ranges that would find the item’s index based on start/step/stop?

Thanks,
Piotr

1 Like

There is a method for StepRange but not for UnitRange:

https://github.com/JuliaLang/julia/blob/36c59c144122dbf09fc0e1f0f1e9defbbd2f254d/base/array.jl#L1760

so yes, it could make sense. If someone is interested, just make a PR.

Thank you, I overlooked it. Actually StepRange is enough for me.