Skip to content

perf: avoid redundant data channel buffer copies - #280

Merged
devopvoid merged 1 commit into
devopvoid:mainfrom
SendableMetatype:perf/data-channel-buffer-windows
Sep 8, 2026
Merged

perf: avoid redundant data channel buffer copies#280
devopvoid merged 1 commit into
devopvoid:mainfrom
SendableMetatype:perf/data-channel-buffer-windows

Conversation

@SendableMetatype

Copy link
Copy Markdown
Contributor

The synchronous send path copied a direct buffer's readable window into a freshly allocated direct buffer before every call, although the native side copies the bytes into its own buffer anyway. A slice of the buffer carries the same window without the extra allocation and copy, and the heap path reuses the existing window copy. A test sends every combination of heap and direct buffers, slices, read-only views, empty buffers and both send methods and checks that the received bytes match and the caller's buffer is untouched.

@devopvoid
devopvoid merged commit 1171ae6 into devopvoid:main Sep 8, 2026
1 check passed
@SendableMetatype
SendableMetatype deleted the perf/data-channel-buffer-windows branch September 8, 2026 13:36
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