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

Fix string allocation in DateTimeParse.ParseByFormat #82861

Merged
merged 3 commits into from
Mar 2, 2023

Conversation

stephentoub
Copy link
Member

If a quote is encountered, the parser searches for the ending quote while also handling escaped characters. It does by adding the interim characters to a temporary ValueStringBuilder. But it then ToString's that builder to produce a temporary string that's examined. This is unnecessary: we can just examine the span from the VSB directly.

If a quote is encountered, the parser searches for the ending quote while also handling escaped characters.  It does by adding the interim characters to a temporary ValueStringBuilder.  But it then ToString's that builder to produce a temporary string that's examined.  This is unnecessary: we can just examine the span from the VSB directly.
@ghost
Copy link

ghost commented Mar 1, 2023

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

Issue Details

If a quote is encountered, the parser searches for the ending quote while also handling escaped characters. It does by adding the interim characters to a temporary ValueStringBuilder. But it then ToString's that builder to produce a temporary string that's examined. This is unnecessary: we can just examine the span from the VSB directly.

Author: stephentoub
Assignees: -
Labels:

area-System.Globalization

Milestone: -

@tarekgh tarekgh added this to the 8.0.0 milestone Mar 1, 2023
@stephentoub stephentoub merged commit 5a5aad9 into dotnet:main Mar 2, 2023
@stephentoub stephentoub deleted the fixdtalloc branch March 2, 2023 19:39
@ghost ghost locked as resolved and limited conversation to collaborators Apr 2, 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.

2 participants