Bug 188243 - fetch().text() should share memory on the same URL
Summary: fetch().text() should share memory on the same URL
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-08-01 17:20 PDT by Saam Barati
Modified: 2018-08-01 18:10 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2018-08-01 17:20:14 PDT
For example, we end up with N*file size memory use here:

```
let files = [];
for (let i = 0; i < 100; ++i)
    files.push("foo.js");

async function load(url) {
    let fetchResponse = await fetch(new Request(url));
    let text = await fetchResponse.text();
    return text;
}

async function loadEverything() {
    let text = [];
    for (let url of files)
        text.push(await load(url));
    return text;
}
```

This is especially bad when "foo.js" is a large file.
Comment 1 Saam Barati 2018-08-01 18:10:33 PDT
<rdar://problem/42836736>