{"ScriptPreparationCode":"function initArray(W = 1000, H = 1000, C = 100) {\r\n let array = Array(H);\r\n\r\n for (let y = 0; y \u003C H; y\u002B\u002B) {\r\n array[y] = Array(W);\r\n for (let x = 0; x \u003C W; x\u002B\u002B) {\r\n array[y][x] = Array(C);\r\n for (let z = 0; z \u003C C; z\u002B\u002B) {\r\n array[y][x][z] = _.random(0, 255);\r\n }\r\n }\r\n }\r\n return array;\r\n}\r\n\r\nfunction createRandomPoint(w, h, c) {\r\n return {\r\n x: _.random(0, w - 1),\r\n y: _.random(0, h - 1),\r\n z: _.random(0, c - 1),\r\n value: _.random(0, 255)\r\n };\r\n};\r\n\r\nfunction updateWithSpread(prevImg) {\r\n const { x, y, z, value } = createRandomPoint(W, H, C);\r\n const newChannel = [\r\n ...prevImg[y][x].slice(0, z),\r\n value,\r\n ...prevImg[y][x].slice(z \u002B 1)\r\n ];\r\n const newCol = [\r\n ...prevImg[y].slice(0, x),\r\n newChannel,\r\n ...prevImg[y].slice(x \u002B 1)\r\n ];\r\n const newImg = [...prevImg.slice(0, y), newCol, ...prevImg.slice(y \u002B 1)];\r\n return newImg;\r\n};\r\n\r\nvar W = 500, H = 500, C = 50;\r\n\r\nvar bigArray = initArray(W, H, C);\r\nvar bigImmutable = Immutable.fromJS(bigArray);\r\n","TestCases":[{"Name":"Spread operator","Code":"bigArray = updateWithSpread(bigArray);","IsDeferred":false},{"Name":"Immutable.js deep List","Code":"const {x,y,z,value} = createRandomPoint(W, H, C);\r\nbigImmutable = bigImmutable.setIn([y,x,z], value);","IsDeferred":false},{"Name":"Mutating the array in place","Code":"const {x,y,z,value} = createRandomPoint(W, H, C);\r\nbigArray[y][x][z] = value;","IsDeferred":false}]}