Skip to content

feat: optimize receiving messages#158

Closed
unsafePtr wants to merge 1 commit into
Marfusios:masterfrom
unsafePtr:feat/optimize-for-reading-messages
Closed

feat: optimize receiving messages#158
unsafePtr wants to merge 1 commit into
Marfusios:masterfrom
unsafePtr:feat/optimize-for-reading-messages

Conversation

@unsafePtr

@unsafePtr unsafePtr commented Sep 28, 2025

Copy link
Copy Markdown
Contributor

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.

@unsafePtr unsafePtr closed this by deleting the head repository Apr 24, 2026
Marfusios added a commit that referenced this pull request May 13, 2026
Merge the receive-path optimization from PR #158 and add further low-allocation improvements for pooled receive buffers, text-send encoding, cached observables, and binary message logging.

Add a BenchmarkDotNet project with documented before/after results so receive buffering, text encoding, observable access, and response-message formatting can be measured repeatably.
@Marfusios

Copy link
Copy Markdown
Owner

@unsafePtr, sorry for the late response, just merged your commit today, thanks!

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.

2 participants