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

Replace bool[] arrays with Span<bool> in XML deserialization #66914

Merged
merged 1 commit into from
Mar 25, 2022

Conversation

stephentoub
Copy link
Member

The XML deserializer tracks for each property whether it's already been seen in the input being deserialized, and to do that the reader allocates a bool[] array. We can instead stackalloc that for a reasonable number of properties.

The XML deserializer tracks for each property whether it's already been seen in the input being deserialized, and to do that the reader allocates a bool[] array.  We can instead stackalloc that for a reasonable number of properties.
Copy link
Member

@StephenMolloy StephenMolloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, though this ILGen stuff always feels fragile to me. Maybe fragile is the wrong word. Easy to get wrong? Hard to debug? Anyway, I'm curious what prompted this PR. Is there another issue that is impacted by not using Span here?

@stephentoub
Copy link
Member Author

Thanks. @StephenMolloy and I spoke offline.

@stephentoub stephentoub merged commit 1f90082 into dotnet:main Mar 25, 2022
@stephentoub stephentoub deleted the xmlserializationboolarray branch March 25, 2022 01:38
radekdoulik pushed a commit to radekdoulik/runtime that referenced this pull request Mar 30, 2022
…66914)

The XML deserializer tracks for each property whether it's already been seen in the input being deserialized, and to do that the reader allocates a bool[] array.  We can instead stackalloc that for a reasonable number of properties.
@ghost ghost locked as resolved and limited conversation to collaborators Apr 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants