ckerr

#55439: perf: skip the upload stream adapter for net.fetch() requests without a body

Merged
Created: Oct 28, 2026, 3:08:38 PM
Merged: Oct 28, 2026, 6:20:45 PM
5 comments
Target: main

Description of Change

net.fetch() wraps every outgoing request in Writable.toWeb() so that it can pipe the request body into it, even when there's no body to send. Writable.toWeb() has a measurable per-call cost, so this PR only calls it when there's a body.

This is one of three independent PRs that speed up protocol.handle() handlers that serve local files with net.fetch(), which is how VS Code serves vscode-file: (microsoft/vscode#341401). #55437 does most of the work by answering local file: fetches without the URL loader, and #55438 speeds up the file: fetches that still use it. This one helps every bodiless net.fetch() that goes through the URL loader, on any scheme.

VS Code workbench load main this PR all three PRs
with VS Code's webRequest listeners 2694 ms 2571 ms (−5%) 1164 ms (−57%)
without listeners 1880 ms 1826 ms (−3%) 1110 ms (−41%)

Medians of 10 interleaved runs on Linux with a non-official release build, replaying VS Code's workbench load: 4,831 requests through VS Code's own vscode-file: handler. The full benchmark notes, written for agents, are here.

Checklist

🤖 Generated with Claude Code

Release Notes

Notes: Improved performance of net.fetch() requests without a body.

Backports

43-x-y
Merged
PR Number
#55447
Merged At
Oct 28, 2026, 8:07:58 PM
Released In
Not yet
Release Date
Not yet
44-x-y
Merged
PR Number
#55445
Merged At
Oct 28, 2026, 7:34:24 PM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#55446
Merged At
Oct 28, 2026, 7:34:48 PM
Released In
Not yet
Release Date
Not yet
46-x-y
In-flight
PR Number
#55444
Waiting to be merged

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron