Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection.read_message() alternative that does not allocate #297

Closed
smabie opened this issue Aug 25, 2022 · 1 comment
Closed

Connection.read_message() alternative that does not allocate #297

smabie opened this issue Aug 25, 2022 · 1 comment
Labels

Comments

@smabie
Copy link

smabie commented Aug 25, 2022

Hi,

I'm using tungstenite right now in an ultra low latency/high performance capacity and was wondering if there's any plans for writing a zero allocation version of read_message() that simply re-uses an existing buffer/slice/vec?

Thanks!

@daniel-abramov
Copy link
Member

Hey, that would be a nice addition indeed. We had an idea to move the WebSocket-related logic into its own small crate (something like tungstenite-core) so that we could reuse it in tungstenite-rs (allowing others to use tungstenite-core directly in case they don't want the buffer management).

This question has actually been asked a couple of times in the past, you may want to look at the current open issue about that: #209 (I think it's about the same thing)

And one that is closed: #172

I'll close this issue since it looks like a duplicate for:

Unfortunately, we have not yet worked on that (was not particularly useful for our specific case), but it's definitely a doable thing to achieve (would require some refactorings to make the underlying frame parsing logic not store any buffer inside, but relying on the buffer provided by the user).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants