NEW 197015
[JSC] Optimize cases of Array.prototype.join/toString on huge empty arrays which result into one-character repeats
https://bugs.webkit.org/show_bug.cgi?id=197015
Summary [JSC] Optimize cases of Array.prototype.join/toString on huge empty arrays wh...
Yacine Bandou
Reported 2019-04-17 09:30:22 PDT
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.
Attachments
Patch (4.73 KB, patch)
2019-04-17 10:00 PDT, Yacine Bandou
no flags
Patch (4.75 KB, patch)
2019-04-17 10:23 PDT, Yacine Bandou
no flags
Patch (6.65 KB, patch)
2019-05-10 09:33 PDT, Yacine Bandou
bandou.yacine: review?
bandou.yacine: commit-queue?
Yacine Bandou
Comment 1 2019-04-17 10:00:23 PDT
Yacine Bandou
Comment 2 2019-04-17 10:23:02 PDT
Olivier Blin
Comment 3 2019-04-18 00:20:26 PDT
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
Yusuke Suzuki
Comment 4 2019-04-18 00:49:58 PDT
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
Yacine Bandou
Comment 5 2019-05-10 09:33:43 PDT
Radar WebKit Bug Importer
Comment 6 2022-07-01 15:39:09 PDT
Note You need to log in before you can comment on or make changes to this bug.