denoland / denoland/fastwebsockets

Allow reading frames into user-provided buffer to avoid allocations

Open
#127 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
1.1k
Forks
112
PR merge metrics
No merged PRs in 30d

Description

Hi!

I’m trying to eliminate memory allocations when using my websocket handler, but read_frame currently allocates a new Vec for (almost) every incoming frame.

Would it be possible to provide an API variant that lets users supply a buffer to read into, avoiding these allocations? Or do you know of any workaround for this issue?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the read_frame entry point and trace where each incoming frame's Vec is allocated. Review the current public API and frame-reading tests, if present, then determine the buffer variant's ownership and reuse behavior. Done means callers can read frames into a user-provided buffer without the per-frame allocation, with coverage for the new API.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.