Skip to content

perf(req): collapse 3-layer body buffering, uWS pause/resume#344

Merged
dimdenGD merged 1 commit into
dimdenGD:mainfrom
jimmyolo:uws_req_stream
May 14, 2026
Merged

perf(req): collapse 3-layer body buffering, uWS pause/resume#344
dimdenGD merged 1 commit into
dimdenGD:mainfrom
jimmyolo:uws_req_stream

Conversation

@jimmyolo
Copy link
Copy Markdown
Contributor

The old body path buffered every request body three times:

  1. uWS's own internal buffer (delivered as ab to onData)
  2. Request.#bufferedData - grown via Buffer.concat([prev, chunk]) on every onData callback
  3. Node's Readable internal queue - fed by _read() re-slicing 128KB at a time out of #bufferedData

@cesco69
Copy link
Copy Markdown
Contributor

cesco69 commented May 12, 2026

@jimmyolo have you seen onDataV2 yet?
https://github.com/uNetworking/uWebSockets.js/blob/29a1a0b15b0402a7a6adef9a5f585412ec7785c2/docs/index.d.ts#L208

I tried implementing this PR:
#339

but I’m not really seeing any performance improvements.

@jimmyolo
Copy link
Copy Markdown
Contributor Author

@cesco69 jimmyolo#2 ~5-10% improvements

@dimdenGD dimdenGD merged commit 6b15433 into dimdenGD:main May 14, 2026
4 checks passed
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.

3 participants