There are some cases where next/next_back is repeatedly called in a loop, where a specialized method would do the same job, except it might be faster if the iterator they adapt has some specialized faster method.
It was the case in #816.
Those benchmarks are not that impressive, they are based on slices that roughly reimplement the while loop themselves. But if the iterator they adapt have a specialized try_[r]fold on which find/find_map/rfind usually rely, then it should be faster.
The code is shorter in multiple cases and I believe clearer.
The partition function did not have any benchmark, there is now one and there are no difference, both 330µs.
There are some cases where
next/next_back
is repeatedly called in a loop, where a specialized method would do the same job, except it might be faster if the iterator they adapt has some specialized faster method. It was the case in #816.Those benchmarks are not that impressive, they are based on slices that roughly reimplement the while loop themselves. But if the iterator they adapt have a specialized
try_[r]fold
on whichfind/find_map/rfind
usually rely, then it should be faster.The code is shorter in multiple cases and I believe clearer.
The
partition
function did not have any benchmark, there is now one and there are no difference, both 330µs.