Closed
Description
Good evening. I ran across a missed optimization I was trying to convert std::result::collect
into using FromIteratator
. My initial version used iter::Scan
, but it proved to be 2 times slower than at --opt-level=3
than the original implementation. I also created a custom iterator that doesn't have the closure, and it compiles down to the same speed as the original std::result::collect
. I'm guessing llvm isn't able to inline the closure for some reason.
I've gathered up this test in a gist. Note that in this example, the Scan1::size_hint()
is different than the std::iter::Scan::size_hint()
method.
cc @thestinger