{"ScriptPreparationCode":"var alpha = \u0022abcdefghijklmnopqrstuvwxyz\u0022;\r\nvar test = [];\r\nfor(var i = 0; i \u003C 100000; i\u002B\u002B){\r\n test.push(alpha[Math.random() * 26]); \r\n}\r\n\r\nvar testStr = test.join(\u0022\u0022);\r\n\r\nfunction djb2Regular(str) {\r\n var hash = 5381;\r\n if (str == null) {\r\n return hash;\r\n }\r\n for (var i = 0; i \u003C str.length; i\u002B\u002B) {\r\n var char = str.charCodeAt(i);\r\n hash = ((hash \u003C\u003C 5) \u002B hash) \u002B char; /* hash * 33 \u002B c */\r\n }\r\n return hash;\r\n}\r\n\r\nfunction hashModule(stdlib, foreign, heap) {\r\n \u0022use asm\u0022;\r\n\r\n function djb2Asm(str) {\r\n var hash = 5381;\r\n \r\n if (str == null) {\r\n return hash;\r\n }\r\n \tvar length = str.length | 0;\r\n for (var i = 0 | 0; i \u003C length; i\u002B\u002B) {\r\n var char = str.charCodeAt(i) | 0;\r\n hash = (((hash \u003C\u003C 5) \u002B hash) \u002B char) | 0; /* hash * 33 \u002B c */\r\n }\r\n return hash | 0;\r\n}\r\n\r\n return { hash: djb2Asm };\r\n}\r\n\r\nvar djb2Asm = hashModule(window, null, null).hash;","TestCases":[{"Name":"regular","Code":"djb2Regular(testStr)","IsDeferred":false},{"Name":"asm","Code":"djb2Asm(testStr)","IsDeferred":false}]}