-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[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
JsonDocument
usage withUtf8JsonReader
for better performance.Introduced
GetDiscriminator
extension method for cleaner discriminator extraction.Reduced memory allocation in JSON deserialization processes.
Updated multiple converters to use the new
GetDiscriminator
method.Changes walkthrough 📝
EvaluateResultConverter.cs
Optimize `EvaluateResult` deserialization with `Utf8JsonReader`
dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/EvaluateResultConverter.cs
JsonDocument
withUtf8JsonReader
for deserialization.GetDiscriminator
for discriminator extraction.EvaluateResult
deserialization.LogEntryConverter.cs
Enhance `LogEntry` deserialization with `Utf8JsonReader`
dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/LogEntryConverter.cs
Utf8JsonReader
forLogEntry
deserialization.JsonDocument
withGetDiscriminator
for type handling.MessageConverter.cs
Improve `Message` deserialization using `Utf8JsonReader`
dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/MessageConverter.cs
JsonDocument
withUtf8JsonReader
forMessage
deserialization.GetDiscriminator
for cleaner type extraction.RealmInfoConverter.cs
Optimize `RealmInfo` deserialization with `Utf8JsonReader`
dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/RealmInfoConverter.cs
RealmInfo
deserialization to useUtf8JsonReader
.GetDiscriminator
for type determination.RemoteValueConverter.cs
Enhance `RemoteValue` deserialization with `Utf8JsonReader`
dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/RemoteValueConverter.cs
JsonDocument
withUtf8JsonReader
forRemoteValue
deserialization.
GetDiscriminator
.JsonExtensions.cs
Introduce `GetDiscriminator` extension for `Utf8JsonReader`
dotnet/src/webdriver/BiDi/Communication/Json/Internal/JsonExtensions.cs
GetDiscriminator
extension method forUtf8JsonReader
.