Bug 188243
| Summary: | fetch().text() should share memory on the same URL | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Saam Barati <saam> |
| Component: | Page Loading | Assignee: | 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 | ||
Saam Barati
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.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Saam Barati
<rdar://problem/42836736>