[dotnet] [bidi] Deserialize message fast instead of defer it#16403
[dotnet] [bidi] Deserialize message fast instead of defer it#16403nvborisenko merged 9 commits intoSeleniumHQ:trunkfrom
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. |
RenderMichael
left a comment
There was a problem hiding this comment.
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
JsonElementobject.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 optimizationdotnet/src/webdriver/BiDi/Communication/Broker.cs
events
JsonElement
type info
BrowsingContextModule.cs
BrowsingContext event subscription updatesdotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs
NetworkModule.cs
Network event subscription updatesdotnet/src/webdriver/BiDi/Network/NetworkModule.cs
ScriptModule.cs
Script event subscription updatesdotnet/src/webdriver/BiDi/Script/ScriptModule.cs
LogModule.cs
Log event subscription updatesdotnet/src/webdriver/BiDi/Log/LogModule.cs