{"ScriptPreparationCode":"const testMap = {\r\n test0: \u0027000\u0027,\r\n test1: \u0027001\u0027,\r\n test2: \u0027002\u0027,\r\n test3: \u0027003\u0027,\r\n test4: \u0027004\u0027,\r\n test5: \u0027005\u0027,\r\n test6: \u0027006\u0027,\r\n test7: \u0027007\u0027,\r\n test8: \u0027008\u0027,\r\n test9: \u0027009\u0027\r\n};\r\n\r\nlet setA = new Set();\r\nsetA.add(000);\r\nsetA.add(001);\r\nsetA.add(002);\r\nsetA.add(003);\r\nsetA.add(004);\r\nsetA.add(005);\r\nsetA.add(006);\r\nsetA.add(007);\r\nsetA.add(008);\r\nsetA.add(009);\r\n\r\n// tiny in-place inverting function using array reduce\r\nconst testMapInverted = Object.keys(testMap).reduce((acc, val) =\u003E {\r\n acc[testMap[val]] = val;\r\n return acc;\r\n}, {});\r\n\r\nfunction numberStringInvertedMapLookup(numberString) {\r\n return testMapInverted.hasOwnProperty(numberString);\r\n}\r\n\r\nfunction numberStringDynamicLookup(numberString) {\r\n return Object.values(testMap).includes(numberString);\r\n}\r\n\r\nfunction numberStringSet(numberString) {\r\n return setA.has(numberString);\r\n}\r\n\r\nfunction getRandomInt(max) {\r\n return Math.floor(Math.random() * Math.floor(max));\r\n}","TestCases":[{"Name":"Inverted map lookup","Code":"for(let i = 0; i \u003C 10000; \u002B\u002Bi) {\r\n numberStringInvertedMapLookup(\u002700\u0027 \u002B getRandomInt(20));\r\n}","IsDeferred":false},{"Name":"Dynamic lookup","Code":"for(let i = 0; i \u003C 10000; \u002B\u002Bi) {\r\n numberStringDynamicLookup(\u002700\u0027 \u002B getRandomInt(20));\r\n}","IsDeferred":false},{"Name":"Set","Code":"for(let i = 0; i \u003C 10000; \u002B\u002Bi) {\r\n numberStringSet(\u002700\u0027 \u002B getRandomInt(20));\r\n}","IsDeferred":false}]}