Workaround to remove unnecessary bounds checks when using {ReadOnly}Span.IsEmpty#19640
Conversation
| @@ -40,7 +40,8 @@ public bool IsEmpty | |||
| [NonVersionable] | |||
There was a problem hiding this comment.
This is ok. It is not changing behavior (for valid lengths). We have done the same change for IsNullOrEmpty that is also marked NonVersionable.
|
Um... I don't think this is a real solution for removing bound checks. |
|
As @mikedn saied
Seems more reasonable implements more cases to estimates bound checks :> |
Could be, I haven't checked yet. But usually it turns out that doing that comes with some trade-offs in the current implementation. And then it's simpler to just change the C# code here and there, for now. |
…pan.IsEmpty (#19640) Signed-off-by: dotnet-bot <[email protected]>
Yes, this is only a workaround for one of the more common uses, until the JIT is able to resolve the issue (if it can). |
…adOnly}Span.IsEmpty (dotnet/coreclr#19640)" This reverts commit 82bd67f.
* Revert "Workaround to remove unnecessary bounds checks when using {ReadOnly}Span.IsEmpty (dotnet/coreclr#19640)"
This reverts commit 82bd67f.
* Update doc comments
* Apply suggestions from code review
Co-authored-by: Robin Lindner <[email protected]>
* Apply suggestions from code review
Co-authored-by: Robin Lindner <[email protected]>
Co-authored-by: Aaron Robinson <[email protected]>
Co-authored-by: Robin Lindner <[email protected]>
Co-authored-by: Robin Lindner <[email protected]>
* Revert "Workaround to remove unnecessary bounds checks when using {ReadOnly}Span.IsEmpty (dotnet/coreclr#19640)"
This reverts commit 82bd67f.
* Update doc comments
* Apply suggestions from code review
Co-authored-by: Robin Lindner <[email protected]>
* Apply suggestions from code review
Co-authored-by: Robin Lindner <[email protected]>
Co-authored-by: Aaron Robinson <[email protected]>
Co-authored-by: Robin Lindner <[email protected]>
Co-authored-by: Robin Lindner <[email protected]>
Workaround for https://github.com/dotnet/coreclr/issues/19620
Disassembly for before/after:

cc @AndyAyersMS, @benaadams, @GrabYourPitchforks, @mikedn