GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — http: cut per-request work on the server hot path by anonrig · Pull Request #30 · anonrig/node Conversation
|
| bench | baseline | this PR | Δ |
|---|---|---|---|
http/simple.js bytes,len=4,c=50 |
111,290 req/s | 117,556 | +5.6% |
http/incoming_headers.js headers=20 |
109,783 | 124,238 | +13.2% |
wrk hello-world, 8 extra request headers, 5 interleaved rounds of 8s (distributions do not overlap):
| handler | baseline median | this PR median | Δ |
|---|---|---|---|
res.end('hello') |
101,799 | 115,613 | +13.6% |
same, but read req.headers.host |
94,629 | 103,678 | +9.6% |
The extra-header case is the realistic one: browsers and proxies send Host plus several other fields, and requireHostHeader used to materialize all of them.
python3 tools/test.py --mode=release --shell <opt-node>: all test/parallel/test-http-*.js that I ran passed (408 files across three batches).
Overlaps with nodejs#65802 and nodejs#65332. Differences from nodejs#65802: the raw-header scan does not allocate toLowerCase() copies, Expect is resolved without materializing req.headers, HTTP/1.0 TE uses the same path, and header names are interned in the parser.
A closed-source coding agent helped write and measure this. The HTTP hot path (parserOnIncoming, _storeHeader, CreateHeaders) was read and checked against the existing tests before opening the PR. Benchmark numbers above are from the two release binaries on this machine, not from a model.
Refs: nodejs#65802
Refs: nodejs#65332
Sorry, something went wrong.
There was an error while loading. Please reload this page.
fbe7035 to
1fda05a
Compare
Signed-off-by: Ayush Chaudhary <[email protected]> PR-URL: nodejs#64251 Fixes: nodejs#64230 Reviewed-By: René <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
Add `Buffer.stringLength(input[, encoding])`, the counterpart of `Buffer.byteLength()`: it returns the number of UTF-16 code units that `buf.toString(encoding)` would produce, without decoding. For UTF-8 the count is computed with simdutf. Invalid input is counted with the same maximal-subpart replacement that the decoder applies, so the result always matches `toString().length`. The other encodings are computed from `byteLength` alone. This lets code that accumulates streamed input check the result against `buffer.constants.MAX_STRING_LENGTH` and size its memory budget before decoding. Refs: nodejs#66062 Signed-off-by: Matteo Collina <[email protected]> PR-URL: nodejs#66064 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Gürgün Dayıoğlu <[email protected]>
OpenSSL no longer applies DNS name constraints to the subject CN by default, but tls.checkServerIdentity() still uses it without a DNS SAN. Enable subject checking during chain verification only when no DNS SAN exists, preserving the existing hostname verification policy. Assisted-by: Codex Signed-off-by: Filip Skokan <[email protected]> PR-URL: nodejs#65957 Refs: https://openssl-library.org/post/2026-09-09-openssl-4.1-alpha/ Reviewed-By: Tim Perry <[email protected]>
`inspector.Session#connectToMainThread()` in a Worker aborted the process on `CHECK_NOT_NULL(parent_handle_)` in `Agent::ConnectToMainThread()` when the parent Environment was created with `kNoCreateInspector`, as embedders that run their own inspector (or none) do. Throw the new `ERR_INSPECTOR_NOT_AVAILABLE` in that case, next to the existing throw for a Worker whose own inspector is not initialized. Refs: nodejs#35025 Signed-off-by: Shelley Vohr <[email protected]> PR-URL: nodejs#65976 Reviewed-By: Kohei Ueno <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]>
Remove allocations and repeated work performed for every request: - reuse a per-connection updateOutgoingData closure and a shared 'finish' listener instead of binding two functions per request, reaching resOnFinish through the connection state stored on the response - cache the ServerResponse options object per server (custom response classes keep receiving a fresh object) - check for Host, Expect, Content-Length and Transfer-Encoding by scanning rawHeaders instead of materializing req.headers, which was built (with per-name toLowerCase calls) for every request even when the application never reads it - cache the rendered status line per status code when the reason phrase is the default, skipping its character validation - cache the complete 'Date: ...' header line in the utcDate cache and the keep-alive header pair for the current server settings - compute the lenient-validation option chain once per message Signed-off-by: Matteo Collina <[email protected]> PR-URL: nodejs#65802 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tim Perry <[email protected]> Reviewed-By: Gürgün Dayıoğlu <[email protected]>
After nodejs#65802, Host/Expect/body checks still allocate toLowerCase() copies and Expect/HTTP/1.0 TE still read req.headers. Compare names without allocating, read those values from rawHeaders, intern parser header names, and skip Title-Case toLowerCase on common outgoing fields. Refs: nodejs#65802 Signed-off-by: Yagiz Nizipli <[email protected]> Assisted-by: a closed-source coding agent
16a6107 to
9b786ff
Compare
Interning every parsed header name lets a client fill the V8 interned string table with unique tokens. Drop that and keep names as ordinary strings. Refs: nodejs#66120 Signed-off-by: Yagiz Nizipli <[email protected]> Assisted-by: a closed-source coding agent
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.