-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[dotnet] [bidi] Avoid intermediate JsonDocument allocation to determine unordered discriminator #15555
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
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
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.
This does increase the complexity of the JSON handling, I agree that it is worth it. A couple of comments.
User description
Motivation and Context
Improve memory allocation.
Before:
After:
Types of changes
Checklist
PR Type
Enhancement
Description
Replaced
JsonDocumentusage withUtf8JsonReaderfor better performance.Introduced
GetDiscriminatorextension method for cleaner discriminator extraction.Reduced memory allocation in JSON deserialization processes.
Updated multiple converters to use the new
GetDiscriminatormethod.Changes walkthrough 📝
EvaluateResultConverter.cs
Optimize `EvaluateResult` deserialization with `Utf8JsonReader`dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/EvaluateResultConverter.cs
JsonDocumentwithUtf8JsonReaderfor deserialization.GetDiscriminatorfor discriminator extraction.EvaluateResultdeserialization.LogEntryConverter.cs
Enhance `LogEntry` deserialization with `Utf8JsonReader`dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/LogEntryConverter.cs
Utf8JsonReaderforLogEntrydeserialization.JsonDocumentwithGetDiscriminatorfor type handling.MessageConverter.cs
Improve `Message` deserialization using `Utf8JsonReader`dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/MessageConverter.cs
JsonDocumentwithUtf8JsonReaderforMessagedeserialization.GetDiscriminatorfor cleaner type extraction.RealmInfoConverter.cs
Optimize `RealmInfo` deserialization with `Utf8JsonReader`dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/RealmInfoConverter.cs
RealmInfodeserialization to useUtf8JsonReader.GetDiscriminatorfor type determination.RemoteValueConverter.cs
Enhance `RemoteValue` deserialization with `Utf8JsonReader`dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/RemoteValueConverter.cs
JsonDocumentwithUtf8JsonReaderforRemoteValuedeserialization.
GetDiscriminator.JsonExtensions.cs
Introduce `GetDiscriminator` extension for `Utf8JsonReader`dotnet/src/webdriver/BiDi/Communication/Json/Internal/JsonExtensions.cs
GetDiscriminatorextension method forUtf8JsonReader.