Repository navigation
perf(runtime): skip static middleware work for non-asset requests - #4854
Conversation
Check the public asset manifest (also compressed-only assets and public asset bases) before parsing `accept-encoding`, and only decode paths containing `%`.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
commit: |
…ing paths Same approach as #4854: keep the raw file list and check the `.html` and `index.html` candidates per request.
The static middleware runs on every request when
serveStaticis enabled (the default for server presets). For requests that are not public assets, it still parsed and sortedaccept-encoding, then made up to 6getAssetlookups withjoinURL, plusdecodePathon every path.Now it returns early unless the path is an asset (also one that only exists compressed, e.g.
x.js.br), a directory with anindex.html, or under a public asset base (which still returns 404 as before).#nitro/virtual/public-assetsgets ahasAsset(id)export that looks upidand its.gz/.br/.zstvariants directly in the manifest (no startup cost or extra memory).decodePathonly runs for paths containing%.Hello-world
GET /api/hello, bundlednode-serverbuild with apublic/dir, Node 24, oha with 100 connections, server pinned to 4 cores (median of 3×8s):serveStatic: false(upper bound)Found while benchmarking
nitro start(#4849).🤖 Generated with AI assistant