perf(node): port internal bindings to Rust#35182
Open
nathanwhit wants to merge 33 commits into
Open
Conversation
cbc895b to
bbb55e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports a large set of
ext:deno_node/internal_binding/*modules from JS/TS into Rust-backed bindings, reducing snapshot payload and moving binding construction into native code.This includes Rust ports for node internal binding utilities, constants, buffer/util, file/options, async/handle/stream/tcp/pipe/http2/tls/http parser, UDP, DNS, and related helpers. It also keeps startup/runtime overhead in check by caching HTTP parser callback trampolines and avoiding unused stream request allocations.
Motivation
The existing JS internal binding modules are serialized into the startup snapshot. Moving them to Rust shrinks the JS snapshot surface and makes the native binding layer more explicit.
Performance Notes
Compared against
main@upstreamd01f3783usingrelease-litebinaries:2,710,344 -> 2,674,672bytes, net-35,672 bytesnode:httpclient+server keep-alive benchmark, 20k requests:977.1 ms1.018 s+4.2%152.7 ms160.0 ms+4.8%node:httpclient+server RSS, 10 runs:230.9 MiB -> 105.4 MiB230.9 MiB -> 105.4 MiB55 MiBThe HTTP benchmark is intentionally combined client+server in one Deno process over a loopback keep-alive socket, so it exercises both request and response parser paths.
Validation
cargo build --profile release-lite -p deno --bin denocargo build --bin deno --bin test_server./x test-node http_parsertests/unit_node/http_test.tsfilters:AsyncLocalStorage propagates into request handlerAsyncLocalStorage enterWith in request handler is isolatedasync_hooks observes request execution resourcerawHeaders are in flattened formatProfiling was done with
flameyand--v8-flags=--perf-basic-prof.