now = function () {return new Date().getTime();} timer = function (f) { return function (i) { var start = now(); var result = f(i); var end = now(); print("Time taken: " + (end - start) + "ms"); return result; } } timer(fib)(20);
Output