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

Provide a way to communicate the current optimal write size #1016

Open
ricea opened this issue Sep 13, 2019 · 0 comments
Open

Provide a way to communicate the current optimal write size #1016

ricea opened this issue Sep 13, 2019 · 0 comments

Comments

@ricea
Copy link
Collaborator

ricea commented Sep 13, 2019

Currently desiredSize on ReadableStreamDefaultController and WritableStreamDefaultWriter always reflects the amount of queue space available. This is connected to how much buffering we use. However, a sink may have 324KB of space available in some internal buffer, invisible to the streams API and consumers of the streams API. It would be nice if writers to the stream could know that they should aim to write a 324KB chunk. Increasing the highWaterMark of the WritableStream doesn't do anything useful in this situation.

In another case, you might have an API where is optimal to write in 64KB chunks, but the value of desiredSize would go down when the queue is full, leading to writing sub-optimal small chunks.

One solution would be to provide a way that underlying sinks could override the value of desiredSize. An alternative would be to provide a differently-named attribute that hinted the optimal chunk size to use right now.

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

No branches or pull requests

1 participant