Skip to content

Conversation

@StephenMolloy
Copy link
Member

Using XmlWriter.Create() instead of XmlTextWriter introduced perf regression.

We have "correctness" reasons for switching to XmlWriter.Create() instead
of sticking with XmlTextWriter. (See #1411 and #46974 as examples.) For
folks who are adversely impacted by this change, they can always get the old
behavior by passing in their own XmlTextWriter when serializing.

In my own playing around with XmlWriter.Create() however, I found there
to be a rather significant penalty for using an "Indent" wrapper. I don't
know why the difference is so large, but I've seen indentation add 60-100%
more time to serialization of large/extensive objects. Removing the
indentation wrapper produces xml that is not very human-readable, but
it is still correct and round-trips serialization. (I don't know what affect
indentation will have on the super-short micro-benchmarks that identified this
regression. My dev machine was not producing consistent or obvious results
wrt which XmlWriter was being used.)

Fixes #56014 and #56352

@StephenMolloy
Copy link
Member Author

@dotnet-bot help

Trigger re-run of tests, which somehow are un-triggerable through more traditional methods.
@StephenMolloy StephenMolloy merged commit 880e67d into dotnet:main Aug 4, 2021
@DrewScoggins
Copy link
Member

@ghost ghost locked as resolved and limited conversation to collaborators Sep 11, 2021
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.

[Perf] Regression in XmlSerialization

3 participants