Skip to content

Conversation

@unsafePtr
Copy link

@unsafePtr unsafePtr commented Sep 28, 2025

Background

  • Eliminated allocations: No more GetBuffer() calls that create new arrays for text messages
  • Improved performance: Single reusable buffer instead of constantly requesting new streams
  • Appropriate tool usage: RecyclableMemoryStream is designed for large streams, which is uncommon in WebSocket
    scenarios. ArrayBufferWriter is more suitable for typical WebSocket message sizes. RecyclableMemoryStream is still used when the user explicitly requests to receive messages as streams (IsStreamDisposedAutomatically = false), maintaining backward compatibility.

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.

1 participant