[dotnet] [bidi] Optimize commands via ReadOnlyMemory#17205
Merged
nvborisenko merged 4 commits intoSeleniumHQ:trunkfrom Mar 11, 2026
Merged
[dotnet] [bidi] Optimize commands via ReadOnlyMemory#17205nvborisenko merged 4 commits intoSeleniumHQ:trunkfrom
nvborisenko merged 4 commits intoSeleniumHQ:trunkfrom
Conversation
Contributor
Review Summary by QodoOptimize BiDi transport with ReadOnlyMemory and ValueTask
WalkthroughsDescription• Optimize BiDi transport by using ReadOnlyMemory<byte> instead of byte[] • Replace Task with ValueTask for better async performance • Add conditional compilation for .NET 8+ native support • Maintain backward compatibility with earlier .NET versions File Changes1. dotnet/src/webdriver/BiDi/ITransport.cs
|
Contributor
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the .NET BiDi transport send path to use ReadOnlyMemory<byte>/ValueTask, enabling more efficient WebSocket sends on .NET 8+ while preserving compatibility on earlier targets.
Changes:
- Change
ITransport.SendAsyncsignature fromTask/byte[]toValueTask/ReadOnlyMemory<byte>. - Update
WebSocketTransport.SendAsyncto use theClientWebSocket.SendAsync(ReadOnlyMemory<byte>, ...)overload on .NET 8+. - Add a NET<8 fallback that converts
ReadOnlyMemory<byte>into anArraySegment<byte>forClientWebSocket.SendAsync(ArraySegment<byte>, ...).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dotnet/src/webdriver/BiDi/WebSocketTransport.cs | Switch send API to ReadOnlyMemory<byte> with NET8 fast-path and NET<8 fallback. |
| dotnet/src/webdriver/BiDi/ITransport.cs | Update transport interface send signature to ValueTask + ReadOnlyMemory<byte>. |
This reverts commit 2bddfd1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💥 What does this PR do?
This pull request updates the BiDi transport interface and its WebSocket implementation to improve performance and compatibility, especially for .NET 8 and later.
🔄 Types of changes