Skip to content

Improve performance of WebSocketMessageHandler#1237

Merged
AArnott merged 1 commit intomainfrom
fix1234
Aug 5, 2025
Merged

Improve performance of WebSocketMessageHandler#1237
AArnott merged 1 commit intomainfrom
fix1234

Conversation

@AArnott
Copy link
Copy Markdown
Member

@AArnott AArnott commented Aug 4, 2025

Fixes #1234

@AArnott AArnott added this to the v2.23 milestone Aug 4, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the performance of the WebSocketMessageHandler by optimizing memory allocation in the WriteCoreAsync method. It modifies the Sequence<byte> constructor to use a shared array pool and sets a minimum span length hint.

  • Uses ArrayPool<byte>.Shared instead of default memory allocation for the sequence builder
  • Sets MinimumSpanLength property to this.sizeHint to optimize buffer sizing

Comment thread src/StreamJsonRpc/WebSocketMessageHandler.cs
@AArnott AArnott enabled auto-merge August 4, 2025 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Websocket message handler writes should consider setting MinimumSpanLength.

3 participants