Remove unnecessary branches in UrlDecoder#7272
Remove unnecessary branches in UrlDecoder#7272davidsh merged 1 commit intodotnet:masterfrom hughbe:patch-1
Conversation
|
LGTM |
|
It's not necessarily a win, e.g. if it's common for the condition to be false and the callee doesn't get inlined. Do you have perf measurements for this showing impact one way or the other? |
|
cc: @davidsh |
I don't have time tonight to do run perf measurements, but it may be more performant to keep the checks at the call site, and remove the check in the actual method implementation. Let me know what you think. |
This makes more sense and should be more performant. FIxed |
|
What's the motivation behind the change? cc: @davidsh |
|
None, just spotted some dead code |
|
I see. I'm ok with it if @davidsh is. |
| @@ -625,11 +625,8 @@ private struct UrlDecoder | |||
|
|
|||
| private void FlushBytes() | |||
| { | |||
There was a problem hiding this comment.
You removed the if (_numBytes > 0) because the caller already checks for it? If so, you should add an Assert() here to verify the condition.
|
Test Innerloop Ubuntu Release Build and Test |
|
LGTM |
Remove unnecessary branches in UrlDecoder Commit migrated from dotnet/corefx@2d4dcfa
FlushBytes already checks for if _numBytes > 0 so we can remove this check at the call site
I renamed FlushBytes to FlushBytesIfNeeded to convey this semantic at the call site
/cc @stephentoub @jamesqo