Fewer loop checks in SkipWhile - #2669
Conversation
|
Looks like something with |
Yeah, https://github.com/dotnet/corefx/issues/2613. @Priya91, FYI. |
There was a problem hiding this comment.
Hmm, the old code was easier to read and maintain IMHO. What kind of speedup do you see here? I'd imagine it wouldn't be very significant vs. general overhead of iterators, but I'm prepared to be proven wrong.
There was a problem hiding this comment.
The new code removes the need for a lifted "yielding" flag an multiple reads of that field. Instead the state machine gets one more state.
This should, in theory, lead to some improvement, but it is indeed curious to know if it indeed made things faster and by how much?
There was a problem hiding this comment.
@jamesqo, do you have measurements to go along with this change?
There was a problem hiding this comment.
@stephentoub Yep, here they are (results). Unfortunately, it looks like nguerrera/Maxwe11 are correct; the new code is barely faster than the old code.
There was a problem hiding this comment.
I've found doing similar work that you really have to do these tests across a range of element types, a range of enumerable types and a range of enumerable sizes. The results can vary considerably.
|
cc: @VSadov |
|
Thanks, @jamesqo. Given the discussion thus far and the lack of demonstrable improvements, I'm going to close this out for now. If you're able to show that this has a real positive impact, please do reopen. Thanks! |
Separated from PR #2318. Sorry if I seem to be making a lot of PRs today haha, I just want to finish up with all of the changes I've made.