Auto merge of #5625 - Eh2406:min_candidates_is_slow, r=alexcrichton
Auto merge of #5625 - Eh2406:min_candidates_is_slow, r=alexcrichton

remove all 4 RC clones in min_candidates. allowing it to be inlined

So I was looking at a profile, and noted that `DepsFrame::min_candidates` was taking ~10% of the runtime. The odd part is that it should be a thin wrapper around `Vec::len()`, and so should be completely inlined away. Also it is the key for the `BinaryHeap` so it gets called a lot! Looking into it `remaining_siblings.clone()` clones the RC in the `RcVecIter` then `.next()` clones `T` witch is a `DepInfo` each part of which is an RC that needs to be cloned. All 4 of these RC clones can be removed, but it is apparently too much for the optimizer. So I added a 'peek' method that uses a normal reference to the inner value instead of an RC clone. After this `DepsFrame::min_candidates` does not appear in the profile results. Probably as the name is inlined away. But is the inlined code faster?

before: 20000000 ticks, 104s, 192.308 ticks/ms
after:    20000000 ticks, 87s,   229.885 ticks/ms

So yes ~16% faster!

All profiling/benchmark was done by commenting out the code from #5213 so its test case would run for a long time. But this should improve the happy path as well.

rust-lang/cargo,tshepang/cargo,nipunn1313/cargo,tshepang/cargo,vojtechkral/cargo,nipunn1313/cargo,nipunn1313/cargo,eminence/cargo,tshepang/cargo,nipunn1313/cargo,vojtechkral/cargo,tsurai/cargo,rustyhorde/cargo,rustyhorde/cargo,rust-lang/cargo,eminence/cargo,rustyhorde/cargo,tsurai/cargo,eminence/cargo,rust-lang/cargo,vojtechkral/cargo,vojtechkral/cargo,eminence/cargo,rustyhorde/cargo,rust-lang/cargo,tshepang/cargo,tsurai/cargo,tsurai/cargo,tsurai/cargo