-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[dotnet] [bidi] Deserialize message fast instead of defer it #16403
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
[dotnet] [bidi] Deserialize message fast instead of defer it #16403
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
PR Code Suggestions ✨Explore these optional code suggestions:
|
Finally, no Gen2 and Gen1 allocations. |
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.
Two tiny comments, in general I really like this change! One more leap towards great performance.
User description
Review after #16402
💥 What does this PR do?
As soon as we received remote message just deserialize it. It also improves memory consumption because of unnecessary
JsonElement
object.Before:
After:
🔄 Types of changes
PR Type
Enhancement
Description
Optimize BiDi message deserialization for better performance
Replace deferred JsonElement with immediate type-specific deserialization
Reduce memory allocation by ~33% in node location operations
Improve screenshot capture performance by ~2ms
Diagram Walkthrough
File Walkthrough
Broker.cs
Core broker deserialization optimization
dotnet/src/webdriver/BiDi/Communication/Broker.cs
events
JsonElement
type info
BrowsingContextModule.cs
BrowsingContext event subscription updates
dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs
NetworkModule.cs
Network event subscription updates
dotnet/src/webdriver/BiDi/Network/NetworkModule.cs
ScriptModule.cs
Script event subscription updates
dotnet/src/webdriver/BiDi/Script/ScriptModule.cs
LogModule.cs
Log event subscription updates
dotnet/src/webdriver/BiDi/Log/LogModule.cs