{"ScriptPreparationCode":"function uuid() {\r\n // Public Domain/MIT\r\n var d = new Date().getTime(); //Timestamp\r\n var d2 =\r\n (typeof performance !== \u0022undefined\u0022 \u0026\u0026\r\n performance.now \u0026\u0026\r\n performance.now() * 1000) ||\r\n 0; //Time in microseconds since page-load or 0 if unsupported\r\n return \u0022xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\u0022.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16; //random number between 0 and 16\r\n if (d \u003E 0) {\r\n //Use timestamp until depleted\r\n r = (d \u002B r) % 16 | 0;\r\n d = Math.floor(d / 16);\r\n } else {\r\n //Use microseconds since page-load if supported\r\n r = (d2 \u002B r) % 16 | 0;\r\n d2 = Math.floor(d2 / 16);\r\n }\r\n return (c === \u0022x\u0022 ? r : (r \u0026 0x3) | 0x8).toString(16);\r\n });\r\n}\r\n\r\nfunction shortId() {\r\n // I generate the UID from two parts here\r\n // to ensure the random number provide enough bits.\r\n let firstPart = (Math.random() * 46656) | 0;\r\n let secondPart = (Math.random() * 46656) | 0;\r\n firstPart = (\u0022000\u0022 \u002B firstPart.toString(36)).slice(-3);\r\n secondPart = (\u0022000\u0022 \u002B secondPart.toString(36)).slice(-3);\r\n return firstPart \u002B secondPart;\r\n}\r\n\r\nfunction shuffle(array) {\r\n let currentIndex = array.length,\r\n randomIndex;\r\n\r\n // While there remain elements to shuffle.\r\n while (currentIndex != 0) {\r\n // Pick a remaining element.\r\n randomIndex = Math.floor(Math.random() * currentIndex);\r\n currentIndex--;\r\n\r\n // And swap it with the current element.\r\n [array[currentIndex], array[randomIndex]] = [\r\n array[randomIndex],\r\n array[currentIndex],\r\n ];\r\n }\r\n\r\n return array;\r\n}\r\n\r\nconst NB_ITEMS = 100000;\r\nvar objectWithVeryShortKeys = {};\r\nvar veryShortKeys = [];\r\nfor (let i = 0; i \u003C NB_ITEMS; i\u002B\u002B) {\r\n let key = shortId();\r\n objectWithVeryShortKeys[key] = Math.random();\r\n veryShortKeys.push(key);\r\n}\r\n\r\nvar objectWithShortKeys = {};\r\nvar shortKeys = [];\r\nfor (let i = 0; i \u003C NB_ITEMS; i\u002B\u002B) {\r\n let key = uuid();\r\n objectWithShortKeys[key] = Math.random();\r\n shortKeys.push(key);\r\n}\r\n\r\nvar objectWithMediumKeys = {};\r\nvar mediumKeys = [];\r\nfor (let i = 0; i \u003C NB_ITEMS; i\u002B\u002B) {\r\n let key = \u0060${uuid()}::${uuid()}\u0060;\r\n objectWithMediumKeys[key] = Math.random();\r\n mediumKeys.push(key);\r\n}\r\n\r\nvar objectWithLongKeys = {};\r\nvar longKeys = [];\r\nfor (let i = 0; i \u003C NB_ITEMS; i\u002B\u002B) {\r\n let key = \u0060${uuid()}::${uuid()}::some_more_text::${uuid()}\u0060;\r\n objectWithLongKeys[key] = Math.random();\r\n longKeys.push(key);\r\n}\r\n\r\nvar objectWithVeryLongKeys = {};\r\nvar veryLongKeys = [];\r\nfor (let i = 0; i \u003C NB_ITEMS; i\u002B\u002B) {\r\n let key = \u0060${uuid()}::${uuid()}::some_more_text::${uuid()}::${uuid()}::${uuid()}::some_more_text::${uuid()}\u0060;\r\n objectWithVeryLongKeys[key] = Math.random();\r\n veryLongKeys.push(key);\r\n}\r\n\r\nshuffle(veryShortKeys);\r\nshuffle(shortKeys);\r\nshuffle(mediumKeys);\r\nshuffle(longKeys);\r\nshuffle(veryLongKeys);","TestCases":[{"Name":"Very short keys","Code":"let str = \u0022\u0022;\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n str \u002B= objectWithVeryShortKeys[veryShortKeys[i]];\r\n}","IsDeferred":false},{"Name":"Short keys","Code":"let shortKeysStr = \u0022\u0022;\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n shortKeysStr \u002B= objectWithShortKeys[shortKeys[i]];\r\n}","IsDeferred":false},{"Name":"Medium keys","Code":"let mediumKeysStr = \u0022\u0022;\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n mediumKeysStr \u002B= objectWithMediumKeys[mediumKeys[i]];\r\n}\r\n","IsDeferred":false},{"Name":"Long keys","Code":"let longKeysStr = \u0022\u0022;\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n longKeysStr \u002B= objectWithLongKeys[longKeys[i]];\r\n}","IsDeferred":false},{"Name":"Very long keys","Code":"let veryLongKeysStr = \u0022\u0022;\r\nfor (let i = 0; i \u003C 10000; i\u002B\u002B) {\r\n veryLongKeysStr \u002B= objectWithVeryLongKeys[veryLongKeys[i]];\r\n}","IsDeferred":false}]}