ckerr

#55438: perf: reuse one file: URL loader factory per session in net.fetch()

Merged
Created: Oct 28, 2026, 3:08:33 PM
Merged: Oct 28, 2026, 10:25:37 PM
6 comments
Target: main

Description of Change

Every net.fetch() of a file: URL builds a new AsarURLLoaderFactory, plus a new webRequest and protocol interception proxy in front of it. This PR builds that once per session and reuses it. The proxy already looks up interceptors and webRequest listeners per request, so ones added or removed after the first fetch still apply. There are new specs for that.

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, so once it's in, most of VS Code's requests skip the code this PR changes. This one still speeds up the file: fetches that #55437 hands to the loader, such as asar paths and Range requests. #55439 is the third.

VS Code workbench load main this PR all three PRs
with VS Code's webRequest listeners 2694 ms 2363 ms (−12%) 1164 ms (−57%)
without listeners 1880 ms 1579 ms (−16%) 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 repeated net.fetch() calls for file: URLs.

Backports

43-x-y
In-flight
PR Number
#55481
Waiting to be merged
44-x-y
Merged
PR Number
#55458
Merged At
Oct 29, 2026, 2:38:32 AM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#55459
Merged At
Oct 29, 2026, 2:38:35 AM
Released In
Not yet
Release Date
Not yet
46-x-y
Merged
PR Number
#55457
Merged At
Oct 29, 2026, 2:38:28 AM
Released In
v46.0.0-alpha.3
Release Date
Oct 29, 2026, 3:00:25 PM

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