Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public Encoding.TryGetBytes/Chars #85120

Merged
merged 1 commit into from Apr 23, 2023

Conversation

stephentoub
Copy link
Member

Fixes #84425

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost assigned stephentoub Apr 20, 2023
@ghost
Copy link

ghost commented Apr 20, 2023

Tagging subscribers to this area: @dotnet/area-system-text-encoding
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #84425

Author: stephentoub
Assignees: -
Labels:

area-System.Text.Encoding, new-api-needs-documentation

Milestone: -

@stephentoub
Copy link
Member Author

@EgorBo, fyi

@EgorBo
Copy link
Member

EgorBo commented Apr 22, 2023

@EgorBo, fyi

I've almost finished it but I'll wait for this PR to land and ideally a daily SDK to pick it up for easier testing/benchmarking if you don't mind 🙂

PS: if we could put this API into Utf8 class it would be easier for JIT but should work as is too. There is a small problem in JIT that it never inlines methods Encoding.UTF8.X without PGO (#85209)

@stephentoub
Copy link
Member Author

There is a small problem in JIT that it never inlines methods Encoding.UTF8.X without PGO (#85209)

😦

"small problem"... so... fixable?

@EgorBo
Copy link
Member

EgorBo commented Apr 23, 2023

There is a small problem in JIT that it never inlines methods Encoding.UTF8.X without PGO (#85209)

😦

"small problem"... so... fixable?

We discussed some solutions, in the worst case we'll just intrinsify Encoding.UTF8 to return exact type right in the importer. But a proper fix will be better since many other use cases will benefit from it. My initial impl needs PGO being enabled but I'll land a workaround after it

@stephentoub stephentoub merged commit a4ae184 into dotnet:main Apr 23, 2023
167 checks passed
@stephentoub stephentoub deleted the encodingtrygetbytes branch April 23, 2023 19:12
@dotnet dotnet locked as resolved and limited conversation to collaborators May 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API Proposal]: Encoding.TryGetBytes/Chars
3 participants