Bug 188243

Summary: fetch().text() should share memory on the same URL
Product: WebKit Reporter: Saam Barati <saam>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: achristensen, beidson, cdumez, rniwa, saam, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

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>