-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Backport bugfixes, infrastructural changes and perf improvements from the polymorphism feature branch #54420
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
Conversation
* Use array instead of list for storing frames. Previous frames can now be passed by reference * Ensure that the _count field always reflects the current depth. * Remove StackFrame.Reset() methods which are occassionally a source of dirty frames being reused.
|
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsThis PR backports a selection of bugfixes, infrastructural changes and perf improvements that were made as part of the polymorphism feature branch in #53882. I have layered the changes into separate that should ideally be reviewed independently:
The changes should make it easier to incorporate the polymorphism infrastructural changes in the future. Overall the changes result in a slight increase in serialization performance, on average between 4-8% faster in our benchmark suite.
|
steveharter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactoring. LGTM with a couple questions.
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs
Show resolved
Hide resolved
...libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Write.String.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ReadStack.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs
Show resolved
Hide resolved
|
Hello @eiriktsarpalis! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
This PR backports a selection of bugfixes, infrastructural changes and perf improvements that were made as part of the polymorphism feature branch in #53882. I have layered the changes into separate commits that should ideally be reviewed independently:
Push()andPop()operations that assist in early detection of stack-corrupting bugs.WriteStackandReadStackimplementations to_countfield always accurately reflects the current stack depth.StackFrame.Reset()methods and instead clearsCurrentby assigning it to adefaultinstance. This eliminates a class of bugs caused by dirty frames being reused in new contexts.typeof(T).IsValueTypeexpressions Optimize typeof(T).IsValueType #1157) in the serialization hot path methods.The changes should make it easier to incorporate the polymorphism infrastructural changes in the future. Overall the changes result in a slight increase in serialization performance, on average between 4-8% faster in our benchmark suite.