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.
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
<rdar://problem/96318246>