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

[Performance] XmlSerializationWriter.WriteTypedPrimitive is converting primitive types to string before writing them to the XmlWriter #76434

Closed
TrayanZapryanov opened this issue Sep 30, 2022 · 0 comments · Fixed by #76436
Assignees
Labels
Milestone

Comments

@TrayanZapryanov
Copy link
Contributor

Description

Possible optimization found.
Current implementation of writing primitive types fallbacks to string using XmlConvert.ToString(..).

protected void WriteTypedPrimitive(string? name, string? ns, object o, bool xsiType)

Regression?

No

Analysis

How to optimize:
Write to char[] and then use XmlWriter.WriteChars(...). This should eliminate all temporary string for int/DateTime/guid.... types, which should be majority when serializing custom types. This change will help us later to use XmlSerializationWriter.WriteTypedPrimitive method in XmlSerializationWriterILGen instead of again creating strings and using XmlConvert.ToString(...)

@TrayanZapryanov TrayanZapryanov added the tenet-performance Performance related issue label Sep 30, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 30, 2022
@StephenMolloy StephenMolloy added this to the Future milestone Feb 2, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Feb 2, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants