{"ScriptPreparationCode":"//const { fromJS } = require(\u0027immutable\u0027);\r\nvar data = { items: {}, count: 0, keys: [] }\r\n\r\nfor (let index = 0; index \u003C 100000; index\u002B\u002B) {\r\n data[index] = { id: index, name: \u0060ITEM-${index}\u0060, value: Math.random() }\r\n data.count\u002B\u002B\r\n data.keys.push(index)\r\n}\r\n\r\nvar NEW_ITEM_ID = data.count \u002B1\r\n\r\nvar produce = immer.default\r\n\r\nvar im = Immutable.fromJS(data);","TestCases":[{"Name":"immer","Code":"data = produce(data, draft =\u003E {\r\n draft.items[NEW_ITEM_ID] = { id: NEW_ITEM_ID, name: \u0027ITEM-NEW\u0027, value: 0 }\r\n draft.counter\u002B\u002B\r\n draft.keys.push(NEW_ITEM_ID)\r\n})","IsDeferred":false},{"Name":"Immutable","Code":"var im = Immutable.fromJS(data);\r\nim = im.set(\u0027items\u0027, im.get(\u0027items\u0027).set(NEW_ITEM_ID, { id: NEW_ITEM_ID, name: \u0027ITEM-NEW\u0027, value: 0 }));\r\nim = im.set(\u0027count\u0027, im.count \u002B1);\r\nim = im.set(\u0027keys\u0027, im.get(\u0027keys\u0027).push(NEW_ITEM_ID));","IsDeferred":false},{"Name":"Shallow copy","Code":"data = {\r\n ...data,\r\n items: {\r\n \t...data.items,\r\n [NEW_ITEM_ID]: { id: NEW_ITEM_ID, name: \u0027ITEM-NEW\u0027, value: 0 },\r\n },\r\n count: data.count \u002B 1,\r\n keys: [...data.keys, NEW_ITEM_ID]\r\n}","IsDeferred":false},{"Name":"Object.assign","Code":"data = Object.assign({}, data, {\r\n ...data,\r\n items: {...data.items, [NEW_ITEM_ID]: { id: NEW_ITEM_ID, name: \u0027ITEM-NEW\u0027, value: 0 }},\r\n count: data.count \u002B 1,\r\n keys: [...data.keys, NEW_ITEM_ID]\r\n})","IsDeferred":false}]}