Noticed while profiling browse performance on a heavy page.
File: browse/src/browser-manager.ts:947
`await res.body()` buffers the entire response into memory just to calculate byte length. On pages with large assets (videos, big JS bundles), this causes memory spikes for no reason.
The content-length header is right there:
const headers = res.headers();
const size = parseInt(headers['content-length'] || '0', 10);
Not every response will have the header, but for the ones that do (most static assets), you skip the full buffer.
Noticed while profiling browse performance on a heavy page.
File:
browse/src/browser-manager.ts:947`await res.body()` buffers the entire response into memory just to calculate byte length. On pages with large assets (videos, big JS bundles), this causes memory spikes for no reason.
The content-length header is right there:
Not every response will have the header, but for the ones that do (most static assets), you skip the full buffer.