{"ScriptPreparationCode":"function mkLazyTest(fn) {\r\n var thunk = fn, ran = false, value = null;\r\n return function() {\r\n if (!ran) {\r\n value = thunk();\r\n ran = true;\r\n }\r\n return value;\r\n };\r\n}\r\n\r\nfunction mkLazyCall(fn) {\r\n var thunk = fn;\r\n var get = function() {\r\n var value = thunk();\r\n get = function() { return value; };\r\n return value;\r\n };\r\n return function() { return get(); };\r\n}\r\n\r\nfunction cfn(v) { \r\n return function() { return v; }\r\n}\r\n\r\nvar fn = cfn(1);\r\nvar lz1 = mkLazyTest(fn);\r\nvar lz2 = mkLazyCall(fn);\r\nvar i = 0, iterations = 1000;","TestCases":[{"Name":"Lazy with existence test","Code":"for (i = 0; i \u003C iterations ; i\u002B\u002B) {\r\n lz1();\r\n}","IsDeferred":false},{"Name":"Lazy with fetch call","Code":"for (i = 0; i \u003C iterations ; i\u002B\u002B) {\r\n lz2();\r\n}","IsDeferred":false}]}