| Summary: | [JSC] Optimize cases of Array.prototype.join/toString on huge empty arrays which result into one-character repeats | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Yacine Bandou <bandou.yacine> | ||||||||
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> | ||||||||
| Status: | NEW --- | ||||||||||
| Severity: | Normal | CC: | bfulgham, ews-watchlist, fpizlo, guijemont, keith_miller, loic.yhuel, mark.lam, msaboff, olivier.blin, saam, ticaiolima, webkit-bug-importer, ysuzuki, zan | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Attachments: |
|
||||||||||
Created attachment 367638 [details]
Patch
Created attachment 367645 [details]
Patch
For reference, this has been done to optimize the memory consumption of the "CPU Memory Allocation" YouTube test here: https://ytlr-cert.appspot.com/2019/main.html?test_type=functional-test Comment on attachment 367645 [details]
Patch
Can you add tests?, like
1. simple test
2. array storage with some element
3. array storage + accessors
4. and so on
Created attachment 369554 [details]
Patch
|
Add a fast case in Array.prototype.join when the array is empty and it uses array_storage indexingType and the separator length is less than 2. Use the same optimisation that is used in the case of UNDECIDED indexingType, in order allocate the final string in one step, instead of appending in a loop which consumes additional temporary memory.