Fix performance regression of some find() methods #25489
Description
Changes to find
made by #24774 introduced some performance regressions (see #24774 (comment)). Unless push!
can be made efficient enough (#24909), we should probably introduce a specialized method for AbstractArray{Bool}
which would compute the number of true entries, allocate a vector of the required size and fill it, as was done before. This is not possible for general iterables since it is not guaranteed that they can be accessed several times, but it should be possible to also apply this strategy to generators, when the backing iterator is an array.
find
also appears to have slightly regressed on generators, but it's not clear whether this regression is real nor why it happens. If new Nanosoldier runs confirm it, it should be investigated.
Activity