{"ScriptPreparationCode":"var arr = new Array(10000).fill([1,2]);","TestCases":[{"Name":"reduce with forEach","Code":"arr.reduce((res, x) =\u003E {\r\n\tx.forEach(item =\u003E {res.push(item)})\r\n \treturn res;\r\n},[]);","IsDeferred":false},{"Name":"flatMap","Code":"arr.flatMap(x =\u003E x);","IsDeferred":false},{"Name":"reduce with forEach (directly)","Code":"arr.reduce((res, x) =\u003E {\r\n\tx.forEach(res.push, res);\r\n \treturn res;\r\n},[]);","IsDeferred":false},{"Name":"flat","Code":"arr.flat();","IsDeferred":false},{"Name":"reduce with apply","Code":"arr.reduce((res, x) =\u003E {\r\n\tArray.prototype.push.apply(res, x);\r\n \treturn res;\r\n},[]);","IsDeferred":false},{"Name":"for with foreach","Code":"const res = [];\r\nfor (let i = 0; i \u003C arr.length ; i\u002B\u002B) {\r\n arr[i].forEach(res.push, res);\r\n}","IsDeferred":false},{"Name":"for with apply","Code":"const res = [];\r\nfor (let i = 0; i \u003C arr.length ; i\u002B\u002B) {\r\n Array.prototype.push.apply(res, arr[i]);\r\n}","IsDeferred":false},{"Name":"nested for","Code":"const res = [];\r\nfor (let i = 0; i \u003C arr.length ; i\u002B\u002B) {\r\n const x = arr[i];\r\n for (let j = 0; j \u003C x.length; j\u002B\u002B) {\r\n res.push(x[j]);\r\n }\r\n}","IsDeferred":false},{"Name":"reduce with while","Code":"arr.reduce((res, x) =\u003E {\r\n let i = x.length;\r\n while (--i \u003E 0) {\r\n res.push(x[i]);\r\n }\r\n \r\n return res;\r\n},[]);","IsDeferred":false},{"Name":"while with foreach","Code":"const res = [];\r\n\r\nlet i = arr.length;\r\nwhile (--i \u003E 0) {\r\n arr[i].forEach(res.push, res);\r\n}","IsDeferred":false},{"Name":"while with apply","Code":"const res = [];\r\n\r\nlet i = arr.length;\r\nwhile (--i \u003E 0) {\r\n Array.prototype.push.apply(res, arr[i]);\r\n}","IsDeferred":false},{"Name":"while with for","Code":"const res = [];\r\n\r\nlet i = arr.length;\r\nwhile (--i \u003E 0) {\r\n const x = arr[i];\r\n for (let j = 0; j \u003C x.length; j\u002B\u002B) {\r\n res.push(x[j]);\r\n }\r\n}","IsDeferred":false},{"Name":"nested while","Code":"const res = [];\r\nlet i = arr.length;\r\n\r\nwhile (--i \u003E 0) {\r\n const x = arr[i];\r\n let j = x.length;\r\n \r\n while(--j \u003E 0) {\r\n res.push(x[j]);\r\n }\r\n}","IsDeferred":false},{"Name":"nested reduce","Code":"arr.reduce((res, x) =\u003E x.reduce((acc, y) =\u003E {\r\n acc.push(y);\r\n return acc;\r\n}, res),[]);","IsDeferred":false}]}