Skip to content

HttpResponse: write the status, Date and Content-Length lines in one piece each - #1958

Open
nigrosimone wants to merge 1 commit into
uNetworking:masterfrom
nigrosimone:fewer-writes-per-head
Open

nigrosimone wants to merge 1 commit into
uNetworking:masterfrom
nigrosimone:fewer-writes-per-head

Conversation

@nigrosimone

Copy link
Copy Markdown
Contributor

A response head is about ten AsyncSocket::write calls, and each one repeats the closed check, the loop data lookup and the cork checks. This writes the status line, the Content-Length line and the uWebSockets mark in one piece each, and the Date line from a copy LoopData prepares when the date ticks: from ten writes to four for a minimal response.

Bytes are identical (static, JS handler, chunked, status over 64 chars, 404, 70 KB body, WebSocket upgrade, with and without the mark).

User-space instructions per request, two copies of the build each: arm64 (OCI A1, Node 26) -18% on a DeclarativeResponse, -4% on a JS handler with status, two headers and end; x64 (Node 24) -20% and -5%. Requests per second swing ±20% between rounds of the same build on both boxes, so a gain this size does not show there.

@nigrosimone
nigrosimone marked this pull request as ready for review October 7, 2026 18:41

This branch has not been deployed

No deployments
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.

1 participant